|
|
|
@ -10,6 +10,7 @@ import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
|
|
import com.op.common.core.domain.R;
|
|
|
|
|
import com.op.common.core.utils.DateUtils;
|
|
|
|
|
import com.op.common.core.utils.uuid.IdUtils;
|
|
|
|
|
import com.op.device.domain.MesReportWork;
|
|
|
|
|
import com.op.system.api.RemoteSapService;
|
|
|
|
|
import com.op.wms.domain.*;
|
|
|
|
|
import com.op.wms.mapper.*;
|
|
|
|
@ -245,30 +246,161 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
|
|
|
|
|
String msgs="操作完成";
|
|
|
|
|
for (WmsProductPut wmsProductPut1:
|
|
|
|
|
wmsProductPut) {
|
|
|
|
|
WmsProductPut wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId());
|
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
|
|
WmsProductPut wmsProductPutSAPById= wmsProductPutMapper.selectWmsProductPutSAPById(wmsProductPut1.getId());
|
|
|
|
|
if (wmsProductPutSAPById!=null){
|
|
|
|
|
List<WmsProductPut> wmsProductPut2= wmsProductPutMapper.selectWmsProductPutSAPByProDuct(wmsProductPutSAPById.getProductOrder());
|
|
|
|
|
if (wmsProductPut2.size()>0){
|
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
for (WmsProductPut wmsProductPut3:
|
|
|
|
|
wmsProductPut2) {
|
|
|
|
|
map.put("AUFNR",wmsProductPut3.getProductOrder());
|
|
|
|
|
map.put("WERKS",wmsProductPut3.getFactoryCode());
|
|
|
|
|
map.put("LGORT",wmsProductPut3.getWhCode());
|
|
|
|
|
map.put("QUANTITY",wmsProductPut3.getPutQuantity());
|
|
|
|
|
map.put("ERFME",wmsProductPut3.getUnitOfMeasure());
|
|
|
|
|
map.put("BATCH",wmsProductPut3.getBatchNumber());
|
|
|
|
|
map.put("HSDAT",wmsProductPut3.getProductDate());
|
|
|
|
|
mapList.add(map);
|
|
|
|
|
}
|
|
|
|
|
R result= remoteSapService.sapOrderReceipt(mapList);
|
|
|
|
|
|
|
|
|
|
int code= result.getCode();
|
|
|
|
|
String msg= result.getMsg();
|
|
|
|
|
WmsProductPut wmsProductPut4=new WmsProductPut();
|
|
|
|
|
wmsProductPut4.setSapMessage(msg);
|
|
|
|
|
if (code==200) {//过账成功
|
|
|
|
|
String date= (String) result.getData();
|
|
|
|
|
wmsProductPut4.setSapProof(date);
|
|
|
|
|
wmsProductPut4.setSapStatus("1");
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
wmsProductPut4.setSapProof("");
|
|
|
|
|
wmsProductPut4.setSapStatus("2");
|
|
|
|
|
}
|
|
|
|
|
wmsProductPutMapper.updateWmsProductPutByIds(wmsProductPut4,wmsProductPut2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return msgs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public WmsProductPut WmsProductPutByWorkOrderqueryPC(WmsProductPut wmsProductPut) {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_" +wmsProductPut.getFactoryCode());
|
|
|
|
|
WmsProductPut wmsProductPut1= wmsProductPutMapper.selectMesReportWork(wmsProductPut);
|
|
|
|
|
return wmsProductPut1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public List<MesReportWork> getReportList(MesReportWork mesReportWork) {
|
|
|
|
|
List<MesReportWork> rlist = wmsProductPutMapper.getReportList(mesReportWork);;
|
|
|
|
|
return rlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public String addReportListSap(List<MesReportWork> mesReportWorks) {
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
String formattedDate = dateFormat.format(date);//批次
|
|
|
|
|
//List<WmsProductPut> wmsProductPutList= new ArrayList<>();
|
|
|
|
|
for (MesReportWork mesReportWork:
|
|
|
|
|
mesReportWorks) {
|
|
|
|
|
WmsProductPut wmsProductPutk=new WmsProductPut();
|
|
|
|
|
//wms_product_put
|
|
|
|
|
mesReportWork.setId(IdUtils.fastSimpleUUID());
|
|
|
|
|
wmsProductPutk.setId(mesReportWork.getId());
|
|
|
|
|
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.setSapStatus("0");
|
|
|
|
|
wmsProductPutk.setBatchNumber(mesReportWork.getBatch());//
|
|
|
|
|
wmsProductPutk.setAttr3(formattedDate);//
|
|
|
|
|
wmsProductPutk.setCreateBy(mesReportWork.getCreateBy());
|
|
|
|
|
wmsProductPutk.setCreateTime(new Date());
|
|
|
|
|
wmsProductPutk.setUnitOfMeasure(mesReportWork.getUnit());
|
|
|
|
|
wmsProductPutk.setProductDate(mesReportWork.getProductDate());
|
|
|
|
|
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<WmsFpStorageNews> 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
|
|
for (MesReportWork mesReportWork:
|
|
|
|
|
mesReportWorks) {
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("AUFNR",wmsProductPut2.getProductOrder());
|
|
|
|
|
map.put("WERKS",wmsProductPut2.getFactoryCode());
|
|
|
|
|
map.put("LGORT",wmsProductPut2.getWhCode());
|
|
|
|
|
map.put("QUANTITY",wmsProductPut2.getPutQuantity());
|
|
|
|
|
map.put("ERFME",wmsProductPut2.getUnitOfMeasure());
|
|
|
|
|
map.put("BATCH",wmsProductPut2.getAttr3());
|
|
|
|
|
map.put("HSDAT",wmsProductPut2.getProductDate());
|
|
|
|
|
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();
|
|
|
|
|
wmsProductPut2.setSapMessage(msg);
|
|
|
|
|
}
|
|
|
|
|
//过账
|
|
|
|
|
R result=remoteSapService.sapOrderReceipt(mapList);
|
|
|
|
|
int code= result.getCode();
|
|
|
|
|
String msg= result.getMsg();
|
|
|
|
|
for (MesReportWork mesReportWork:
|
|
|
|
|
mesReportWorks) {
|
|
|
|
|
WmsProductPut wmsProductPut2=new WmsProductPut();
|
|
|
|
|
wmsProductPut2.setId(mesReportWork.getId());
|
|
|
|
|
wmsProductPut2.setSapMessage(msg);
|
|
|
|
|
if (code==200) {//过账成功
|
|
|
|
|
String date= (String) result.getData();
|
|
|
|
|
wmsProductPut2.setSapProof(date);
|
|
|
|
|
String tem= (String) result.getData();
|
|
|
|
|
wmsProductPut2.setSapProof(tem);
|
|
|
|
|
wmsProductPut2.setSapStatus("1");
|
|
|
|
|
}else {
|
|
|
|
|
wmsProductPut2.setSapStatus("2");
|
|
|
|
|
}
|
|
|
|
|
wmsProductPutMapper.updateWmsProductPut(wmsProductPut2);
|
|
|
|
|
}
|
|
|
|
|
return msgs;
|
|
|
|
|
String SUCCESS="操作完成";
|
|
|
|
|
return SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|