diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java index 63e72a47..94e0d59d 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/WmsProductPutServiceImpl.java @@ -320,11 +320,15 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { List wmsReportWorkListagain=new ArrayList<>(); //获取当前所选工厂 + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + String factoryCode = request.getHeader(key.substring(8)).replace("ds_",""); + for (wmsReportWork mesReportWork: mesReportWorks) { WmsProductPut wmsProductPutk=new WmsProductPut(); wmsProductPutk.setWorkOrder(mesReportWork.getReportCode()); - wmsProductPutk.setFactoryCode(mesReportWork.getFactoryCode()); + wmsProductPutk.setFactoryCode(factoryCode); wmsProductPutk.setWhCode(mesReportWork.getWhCode());//仓库编码 wmsProductPutk.setProductName(mesReportWork.getProductName()); wmsProductPutk.setProductCode(mesReportWork.getProductCode()); @@ -348,7 +352,7 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { wmsReportWorkList) { WmsProductPut wmsProductPutk=new WmsProductPut(); wmsProductPutk.setWorkOrder(mesReportWork.getReportCode()); - wmsProductPutk.setFactoryCode(mesReportWork.getFactoryCode()); + wmsProductPutk.setFactoryCode(factoryCode); wmsProductPutk.setWhCode(mesReportWork.getWhCode());//仓库编码 wmsProductPutk.setProductName(mesReportWork.getProductName()); wmsProductPutk.setProductCode(mesReportWork.getProductCode()); @@ -365,163 +369,161 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService { } } //先屏蔽起来 -// for (wmsReportWork mesReportWork: -// wmsReportWorkListRk) { -// WmsProductPut wmsProductPutk=new WmsProductPut(); -// //wms_product_put -// mesReportWork.setId(IdUtils.fastSimpleUUID()); -// -// wmsProductPutk.setWorkOrder(mesReportWork.getReportCode()); -// wmsProductPutk.setFactoryCode(mesReportWork.getFactoryCode()); -// wmsProductPutk.setWhCode(mesReportWork.getWhCode());//仓库编码 -// wmsProductPutk.setProductName(mesReportWork.getProductName()); -// wmsProductPutk.setProductCode(mesReportWork.getProductCode()); -// wmsProductPutk.setProductOrder(mesReportWork.getWorkorderCodeSap()); -// wmsProductPutk.setPlanQuantity(mesReportWork.getQuantityFeedback()); -// wmsProductPutk.setPutQuantity(mesReportWork.getQuantityQualified()); -// wmsProductPutk.setStatus("1"); -// wmsProductPutk.setUnitOfMeasure(mesReportWork.getUnit()); -// wmsProductPutk.setBatchNumber(mesReportWork.getBatch());// -// //List wmsProductPutList= wmsProductPutMapper.selectWmsProductPutList(wmsProductPutk); -// -// wmsProductPutk.setAttr3(formattedDate);// -// wmsProductPutk.setCreateBy(mesReportWork.getCreateBy()); -// wmsProductPutk.setCreateTime(new Date()); -// -// wmsProductPutk.setProductDate(mesReportWork.getProductDate()); -// wmsProductPutk.setId(mesReportWork.getId()); -// wmsProductPutk.setSapStatus("0"); -// wmsProductPutMapper.insertWmsProductPut(wmsProductPutk); -// //入库记录 -// WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords(); -// wmsProductPutRecords.setWorkOrder(mesReportWork.getReportCode()); -// wmsProductPutRecords.setProductOrder(mesReportWork.getWorkorderCodeSap()); -// wmsProductPutRecords.setProductName(mesReportWork.getProductName()); -// wmsProductPutRecords.setProductCode(mesReportWork.getProductCode()); -// wmsProductPutRecords.setWhCode(mesReportWork.getWhCode());//仓库编码 -// wmsProductPutRecords.setId(IdUtils.fastSimpleUUID()); -// wmsProductPutRecords.setNumber(mesReportWork.getQuantityQualified().toString()); -// wmsProductPutRecords.setCreateBy(mesReportWork.getCreateBy()); -// wmsProductPutRecords.setCreateTime(new Date()); -// wmsProductPutRecordsMapper.insertWmsProductPutRecords(wmsProductPutRecords); -// -// -// WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews(); -// -// wmsFpStorageNews.setWhCode(mesReportWork.getWhCode());//仓库编码 -// // wmsFpStorageNews.setWlCode(mesReportWork.getWlCode()); -// wmsFpStorageNews.setStorageType("成品"); -// wmsFpStorageNews.setProductCode(mesReportWork.getProductCode()); -// wmsFpStorageNews.setProductName(mesReportWork.getProductName()); -// wmsFpStorageNews.setFactoryCode(mesReportWork.getFactoryCode()); -// wmsFpStorageNews.setActiveFlag("1"); -// wmsFpStorageNews.setUserDefined1(mesReportWork.getUnit()); -// List wmsFpStorageNewsList= wmsFpStorageNewsMapper.selectWmsFpStorageNewsList(wmsFpStorageNews); -// wmsFpStorageNews.setStorageId(IdUtils.fastSimpleUUID()); -// wmsFpStorageNews.setAmount(mesReportWork.getQuantityQualified()); -// wmsFpStorageNews.setCreateBy(mesReportWork.getCreateBy()); -// wmsFpStorageNews.setCreateTime(new Date()); -// if (wmsFpStorageNewsList.size()>0){ -// WmsFpStorageNews wmsFpStorageNews1= wmsFpStorageNewsList.get(0); -// BigDecimal amount= wmsFpStorageNews1.getAmount(); -// BigDecimal amountAdd= amount.add(wmsFpStorageNews.getAmount()); -// wmsFpStorageNews1.setAmount(amountAdd); -// wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews1); -// }else { -// wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews); -// } -// } -// if(wmsReportWorkListRk.size()>0){ -// List> mapList = new ArrayList<>(); -// for (wmsReportWork mesReportWork: -// wmsReportWorkListRk) { -// Map map = new HashMap<>(); -// map.put("AUFNR",mesReportWork.getWorkorderCodeSap()); -// map.put("WERKS",mesReportWork.getFactoryCode()); -// map.put("LGORT",mesReportWork.getWhCode()); -// map.put("QUANTITY",mesReportWork.getQuantityQualified()); -// map.put("ERFME",mesReportWork.getUnit()); -// map.put("BATCH",mesReportWork.getBatch()); -// map.put("HSDAT",mesReportWork.getProductDate()); -// mapList.add(map); -// } -// //过账 -// R result=remoteSapService.sapOrderReceipt(mapList); -// int code= result.getCode(); -// String msg= result.getMsg(); -// for (wmsReportWork mesReportWork: -// wmsReportWorkListRk) { -// WmsProductPut wmsProductPut2=new WmsProductPut(); -// wmsProductPut2.setId(mesReportWork.getId()); -// wmsProductPut2.setSapMessage(msg); -// if (code==200) {//过账成功 -// String tem= (String) result.getData(); -// wmsProductPut2.setSapProof(tem); -// wmsProductPut2.setSapStatus("1"); -// }else { -// wmsProductPut2.setSapStatus("2"); -// } -// wmsProductPutMapper.updateWmsProductPut(wmsProductPut2); -// } -// } -// if (wmsReportWorkListagain.size()>0){ -// List> mapList = new ArrayList<>(); -// for (wmsReportWork mesReportWork: -// wmsReportWorkListagain) { -// Map map = new HashMap<>(); -// map.put("AUFNR",mesReportWork.getWorkorderCodeSap()); -// map.put("WERKS",mesReportWork.getFactoryCode()); -// map.put("LGORT",mesReportWork.getWhCode()); -// map.put("QUANTITY",mesReportWork.getQuantityQualified()); -// map.put("ERFME",mesReportWork.getUnit()); -// map.put("BATCH",mesReportWork.getBatch()); -// map.put("HSDAT",mesReportWork.getProductDate()); -// mapList.add(map); -// } -// //过账 -// R result=remoteSapService.sapOrderReceipt(mapList); -// int code= result.getCode(); -// String msg= result.getMsg(); -// for (wmsReportWork mesReportWork: -// wmsReportWorkListagain) { -// WmsProductPut wmsProductPut2=new WmsProductPut(); -// wmsProductPut2.setId(mesReportWork.getId()); -// wmsProductPut2.setSapMessage(msg); -// if (code==200) {//过账成功 -// String tem= (String) result.getData(); -// wmsProductPut2.setSapProof(tem); -// wmsProductPut2.setSapStatus("1"); -// }else { -// wmsProductPut2.setSapStatus("2"); -// } -// wmsProductPutMapper.updateWmsProductPut(wmsProductPut2); -// } -// } -// //加上质检任务 - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String key = "#header.poolName"; - String factoryCode = request.getHeader(key.substring(8)).replace("ds_",""); + for (wmsReportWork mesReportWork: + wmsReportWorkListRk) { + WmsProductPut wmsProductPutk=new WmsProductPut(); + //wms_product_put + mesReportWork.setId(IdUtils.fastSimpleUUID()); + + wmsProductPutk.setWorkOrder(mesReportWork.getReportCode()); + wmsProductPutk.setFactoryCode(factoryCode); + wmsProductPutk.setWhCode(mesReportWork.getWhCode());//仓库编码 + wmsProductPutk.setProductName(mesReportWork.getProductName()); + wmsProductPutk.setProductCode(mesReportWork.getProductCode()); + wmsProductPutk.setProductOrder(mesReportWork.getWorkorderCodeSap()); + wmsProductPutk.setPlanQuantity(mesReportWork.getQuantityFeedback()); + wmsProductPutk.setPutQuantity(mesReportWork.getQuantityQualified()); + wmsProductPutk.setStatus("1"); + wmsProductPutk.setUnitOfMeasure(mesReportWork.getUnit()); + wmsProductPutk.setBatchNumber(mesReportWork.getBatch());// + //List wmsProductPutList= wmsProductPutMapper.selectWmsProductPutList(wmsProductPutk); + + wmsProductPutk.setAttr3(formattedDate);// + wmsProductPutk.setCreateBy(mesReportWork.getCreateBy()); + wmsProductPutk.setCreateTime(new Date()); + + wmsProductPutk.setProductDate(mesReportWork.getProductDate()); + wmsProductPutk.setId(mesReportWork.getId()); + wmsProductPutk.setSapStatus("0"); + wmsProductPutMapper.insertWmsProductPut(wmsProductPutk); + //入库记录 + WmsProductPutRecords wmsProductPutRecords=new WmsProductPutRecords(); + wmsProductPutRecords.setWorkOrder(mesReportWork.getReportCode()); + wmsProductPutRecords.setProductOrder(mesReportWork.getWorkorderCodeSap()); + wmsProductPutRecords.setProductName(mesReportWork.getProductName()); + wmsProductPutRecords.setProductCode(mesReportWork.getProductCode()); + wmsProductPutRecords.setWhCode(mesReportWork.getWhCode());//仓库编码 + wmsProductPutRecords.setId(IdUtils.fastSimpleUUID()); + wmsProductPutRecords.setNumber(mesReportWork.getQuantityQualified().toString()); + wmsProductPutRecords.setCreateBy(mesReportWork.getCreateBy()); + wmsProductPutRecords.setCreateTime(new Date()); + wmsProductPutRecordsMapper.insertWmsProductPutRecords(wmsProductPutRecords); - for (wmsReportWork wmsReportWork: - wmsReportWorkListagain) { - QcCheckTaskWarehousingDTO qcCheckTaskWarehousingDTO = new QcCheckTaskWarehousingDTO(); - qcCheckTaskWarehousingDTO.setFactoryCode(factoryCode); - qcCheckTaskWarehousingDTO.setIncomeBatchNo(wmsReportWork.getBatch()); - qcCheckTaskWarehousingDTO.setOrderNo(wmsReportWork.getWorkorderCodeSap()); - qcCheckTaskWarehousingDTO.setMaterialCode(wmsReportWork.getProductCode()); - qcCheckTaskWarehousingDTO.setMaterialName(wmsReportWork.getProductName()); - qcCheckTaskWarehousingDTO.setCheckType("checkTypeCP"); - qcCheckTaskWarehousingDTO.setQuality(wmsReportWork.getQuantityQualified()); - qcCheckTaskWarehousingDTO.setSupplierName("小榄成品现货仓"); - qcCheckTaskWarehousingDTO.setSupplierCode(wmsReportWork.getWhCode()); - qcCheckTaskWarehousingDTO.setCheckLoc("mjtest"); - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date productDate = simpleDateFormat.parse(wmsReportWork.getProductDate()); - qcCheckTaskWarehousingDTO.setIncomeTime(productDate); - //qcCheckTaskWarehousingDTO. - remoteQualityService.createProductTask(qcCheckTaskWarehousingDTO); + WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews(); + + wmsFpStorageNews.setWhCode(mesReportWork.getWhCode());//仓库编码 + // wmsFpStorageNews.setWlCode(mesReportWork.getWlCode()); + wmsFpStorageNews.setStorageType("成品"); + wmsFpStorageNews.setProductCode(mesReportWork.getProductCode()); + wmsFpStorageNews.setProductName(mesReportWork.getProductName()); + wmsFpStorageNews.setFactoryCode(factoryCode); + wmsFpStorageNews.setActiveFlag("1"); + wmsFpStorageNews.setUserDefined1(mesReportWork.getUnit()); + List wmsFpStorageNewsList= wmsFpStorageNewsMapper.selectWmsFpStorageNewsList(wmsFpStorageNews); + wmsFpStorageNews.setStorageId(IdUtils.fastSimpleUUID()); + wmsFpStorageNews.setAmount(mesReportWork.getQuantityQualified()); + wmsFpStorageNews.setCreateBy(mesReportWork.getCreateBy()); + wmsFpStorageNews.setCreateTime(new Date()); + if (wmsFpStorageNewsList.size()>0){ + WmsFpStorageNews wmsFpStorageNews1= wmsFpStorageNewsList.get(0); + BigDecimal amount= wmsFpStorageNews1.getAmount(); + BigDecimal amountAdd= amount.add(wmsFpStorageNews.getAmount()); + wmsFpStorageNews1.setAmount(amountAdd); + wmsFpStorageNewsMapper.updateWmsFpStorageNews(wmsFpStorageNews1); + }else { + wmsFpStorageNewsMapper.insertWmsFpStorageNews(wmsFpStorageNews); + } + } + if(wmsReportWorkListRk.size()>0){ + List> mapList = new ArrayList<>(); + for (wmsReportWork mesReportWork: + wmsReportWorkListRk) { + Map map = new HashMap<>(); + map.put("AUFNR",mesReportWork.getWorkorderCodeSap()); + map.put("WERKS",factoryCode); + map.put("LGORT",mesReportWork.getWhCode()); + map.put("QUANTITY",mesReportWork.getQuantityQualified()); + map.put("ERFME",mesReportWork.getUnit()); + map.put("BATCH",mesReportWork.getBatch()); + String formattedsDate = mesReportWork.getProductDate().replace("-", ""); + map.put("HSDAT",formattedsDate); + mapList.add(map); + } + //过账 + R result=remoteSapService.sapOrderReceipt(mapList); + int code= result.getCode(); + String msg= result.getMsg(); + for (wmsReportWork mesReportWork: + wmsReportWorkListRk) { + WmsProductPut wmsProductPut2=new WmsProductPut(); + wmsProductPut2.setId(mesReportWork.getId()); + wmsProductPut2.setSapMessage(msg); + if (code==200) {//过账成功 + String tem= (String) result.getData(); + wmsProductPut2.setSapProof(tem); + wmsProductPut2.setSapStatus("1"); + }else { + wmsProductPut2.setSapStatus("2"); + } + wmsProductPutMapper.updateWmsProductPut(wmsProductPut2); + } } + if (wmsReportWorkListagain.size()>0){ + List> mapList = new ArrayList<>(); + for (wmsReportWork mesReportWork: + wmsReportWorkListagain) { + Map map = new HashMap<>(); + map.put("AUFNR",mesReportWork.getWorkorderCodeSap()); + map.put("WERKS",factoryCode); + map.put("LGORT",mesReportWork.getWhCode()); + map.put("QUANTITY",mesReportWork.getQuantityQualified()); + map.put("ERFME",mesReportWork.getUnit()); + map.put("BATCH",mesReportWork.getBatch()); + String formattedsDate = mesReportWork.getProductDate().replace("-", ""); + map.put("HSDAT",formattedsDate); + mapList.add(map); + } + //过账 + R result=remoteSapService.sapOrderReceipt(mapList); + int code= result.getCode(); + String msg= result.getMsg(); + for (wmsReportWork mesReportWork: + wmsReportWorkListagain) { + WmsProductPut wmsProductPut2=new WmsProductPut(); + wmsProductPut2.setId(mesReportWork.getId()); + wmsProductPut2.setSapMessage(msg); + if (code==200) {//过账成功 + String tem= (String) result.getData(); + wmsProductPut2.setSapProof(tem); + wmsProductPut2.setSapStatus("1"); + }else { + wmsProductPut2.setSapStatus("2"); + } + wmsProductPutMapper.updateWmsProductPut(wmsProductPut2); + } + } +// +// for (wmsReportWork wmsReportWork: +// wmsReportWorkListagain) { +// QcCheckTaskWarehousingDTO qcCheckTaskWarehousingDTO = new QcCheckTaskWarehousingDTO(); +// qcCheckTaskWarehousingDTO.setFactoryCode(factoryCode); +// qcCheckTaskWarehousingDTO.setIncomeBatchNo(wmsReportWork.getBatch()); +// qcCheckTaskWarehousingDTO.setOrderNo(wmsReportWork.getWorkorderCodeSap()); +// qcCheckTaskWarehousingDTO.setMaterialCode(wmsReportWork.getProductCode()); +// qcCheckTaskWarehousingDTO.setMaterialName(wmsReportWork.getProductName()); +// qcCheckTaskWarehousingDTO.setCheckType("checkTypeCP"); +// qcCheckTaskWarehousingDTO.setQuality(wmsReportWork.getQuantityQualified()); +// +// qcCheckTaskWarehousingDTO.setSupplierName("小榄成品现货仓"); +// qcCheckTaskWarehousingDTO.setSupplierCode(wmsReportWork.getWhCode()); +// qcCheckTaskWarehousingDTO.setCheckLoc("mjtest"); +// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); +// Date productDate = simpleDateFormat.parse(wmsReportWork.getProductDate()); +// qcCheckTaskWarehousingDTO.setIncomeTime(productDate); +// //qcCheckTaskWarehousingDTO. +// remoteQualityService.createProductTask(qcCheckTaskWarehousingDTO); +// } String SUCCESS="操作完成"; return SUCCESS;