|
|
@ -12,10 +12,12 @@ import com.win.module.wms.dal.dataobject.interfaceinfo.InterfaceInfoDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchase.PurchaseDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasePlan.PurchasePlanDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasePlan.PurchasePlanMainDO; |
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRecord.PurchasereceiptRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.supplieritem.SupplieritemDO; |
|
|
|
import com.win.module.wms.dal.mysql.purchase.PurchaseDetailMapper; |
|
|
|
import com.win.module.wms.dal.mysql.purchasePlan.PurchasePlanDetailMapper; |
|
|
|
import com.win.module.wms.dal.mysql.purchasePlan.PurchasePlanMainMapper; |
|
|
|
import com.win.module.wms.dal.mysql.purchasereceiptRecord.PurchasereceiptRecordDetailMapper; |
|
|
|
import com.win.module.wms.enums.common.InterfaceTypeEnum; |
|
|
|
import com.win.module.wms.service.interfaceinfo.InterfaceInfoService; |
|
|
|
import com.win.module.wms.service.itembasic.ItembasicService; |
|
|
@ -23,6 +25,7 @@ import com.win.module.wms.service.purchase.PurchaseMainService; |
|
|
|
import com.win.module.wms.service.supplieritem.SupplieritemService; |
|
|
|
import com.win.module.wms.util.LocalDateTimeAdapter; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
@ -60,9 +63,10 @@ public class PurchasePlanDetailServiceImpl implements PurchasePlanDetailService |
|
|
|
private PurchaseMainService purchaseMainService; |
|
|
|
@Resource |
|
|
|
private PurchaseDetailMapper purchaseDetailMapper; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private InterfaceInfoService interfaceInfoService; |
|
|
|
@Resource |
|
|
|
private PurchasereceiptRecordDetailMapper purchasereceiptRecordDetailMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Long createPurchasePlanDetail(PurchasePlanDetailCreateReqVO createReqVO) { |
|
|
@ -356,7 +360,6 @@ public class PurchasePlanDetailServiceImpl implements PurchasePlanDetailService |
|
|
|
throw exception(PURCHASE_PLAN_DELIVERYDATE_NOT_MIN,uesDate,planMainDOS1.get(0).getNumber(),selectDate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -379,4 +382,38 @@ public class PurchasePlanDetailServiceImpl implements PurchasePlanDetailService |
|
|
|
return supplieritemService.selectSupplierItemExist(supplierCode, itemCode); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
public BigDecimal updatePurchaseReceiveQty(String planNumber,String poNumber,String poLine,String itemCode) { |
|
|
|
QueryWrapper<PurchasereceiptRecordDetailDO> purchasereceiptRecordDetailDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
purchasereceiptRecordDetailDOQueryWrapper.select("sum(qty) as qty,po_number,po_line,item_code"); |
|
|
|
purchasereceiptRecordDetailDOQueryWrapper.inSql("number","select number from record_purchasereceipt_main where pp_number='"+planNumber+"'"); |
|
|
|
purchasereceiptRecordDetailDOQueryWrapper.eq("po_number",poNumber); |
|
|
|
purchasereceiptRecordDetailDOQueryWrapper.eq("po_line",poLine); |
|
|
|
purchasereceiptRecordDetailDOQueryWrapper.eq("item_code",itemCode); |
|
|
|
purchasereceiptRecordDetailDOQueryWrapper.isNull("parent_packing_number"); |
|
|
|
purchasereceiptRecordDetailDOQueryWrapper.groupBy("po_number","po_line","item_code"); |
|
|
|
List<PurchasereceiptRecordDetailDO> purchasereceiptRecordDetailDOList = purchasereceiptRecordDetailMapper.selectList(purchasereceiptRecordDetailDOQueryWrapper); |
|
|
|
if(purchasereceiptRecordDetailDOList != null && purchasereceiptRecordDetailDOList.size() > 0){ |
|
|
|
BigDecimal sumQty = BigDecimal.ZERO; |
|
|
|
for(PurchasereceiptRecordDetailDO purchasereceiptRecordDetailDO:purchasereceiptRecordDetailDOList){ |
|
|
|
sumQty = sumQty.add(purchasereceiptRecordDetailDO.getQty()); |
|
|
|
} |
|
|
|
QueryWrapper<PurchasePlanDetailDO> purchasePlanDetailDOQueryWrapper = new QueryWrapper<>(); |
|
|
|
purchasePlanDetailDOQueryWrapper.eq("number",planNumber); |
|
|
|
purchasePlanDetailDOQueryWrapper.eq("po_number ", poNumber); |
|
|
|
purchasePlanDetailDOQueryWrapper.eq("po_line", poLine); |
|
|
|
purchasePlanDetailDOQueryWrapper.eq("item_code", itemCode); |
|
|
|
PurchasePlanDetailDO purchasePlanDetailDO = purchasePlanDetailMapper.selectOne(purchasePlanDetailDOQueryWrapper,false); |
|
|
|
if(purchasePlanDetailDO != null){ |
|
|
|
purchasePlanDetailDO.setReceivedQty(sumQty); |
|
|
|
purchasePlanDetailMapper.updateById(purchasePlanDetailDO); |
|
|
|
} |
|
|
|
return sumQty; |
|
|
|
}else { |
|
|
|
return BigDecimal.ZERO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|