wms修改18.4-报工页面的质检任务生成

master
mengjiao 1 year ago
parent 6f63517cf0
commit 6cc3e25bf0

@ -1,5 +1,6 @@
package com.op.wms.controller;
import java.text.ParseException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@ -126,7 +127,7 @@ public class WmsProductPutController extends BaseController {
return rlist;
}
@PostMapping("/addReportListSap")
public AjaxResult addReportListSap(@RequestBody List<wmsReportWork> mesReportWork) {
public AjaxResult addReportListSap(@RequestBody List<wmsReportWork> mesReportWork) throws ParseException {
String rlist = wmsProductPutService.addReportListSap(mesReportWork);
return AjaxResult.success(rlist);
}

@ -1,5 +1,6 @@
package com.op.wms.service;
import java.text.ParseException;
import java.util.List;
import com.op.system.api.domain.wms.wmsReportWork;
@ -75,5 +76,5 @@ public interface IWmsProductPutService {
List<wmsReportWork> getReportList(wmsReportWork mesReportWork);
String addReportListSap(List<wmsReportWork> mesReportWork);
String addReportListSap(List<wmsReportWork> mesReportWork) throws ParseException;
}

@ -158,7 +158,7 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
//wms_raw_order_in_sn
WmsRawOrderInSn wmsRawOrderInSn=new WmsRawOrderInSn();
wmsRawOrderInSn.setRawOrderInSnId(IdUtils.fastSimpleUUID());
wmsRawOrderInSn.setUserDefined1("1");//出入库
wmsRawOrderInSn.setUserDefined1("1");//
wmsRawOrderInSn.setUserDefined2(odsProcureOrder.getIncomeBatchNo());//批次
wmsRawOrderInSn.setWhCode(odsProcureOrder.getWhCode());//厂库编号
wmsRawOrderInSn.setPoNo(order.getProcureCode());//采购单号
@ -186,8 +186,8 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
QcCheckTaskIncomeDTO qcCheckTaskIncomeDTO=new QcCheckTaskIncomeDTO();
qcCheckTaskIncomeDTO.setCheckLoc("mjtest");
qcCheckTaskIncomeDTO.setCheckType("checkTypeLL");
qcCheckTaskIncomeDTO.setCheckManCode("mobile");
qcCheckTaskIncomeDTO.setCheckManName("手持测试用户");
// qcCheckTaskIncomeDTO.setCheckManCode("mobile");
// qcCheckTaskIncomeDTO.setCheckManName("手持测试用户");
qcCheckTaskIncomeDTO.setSupplierCode(order.getSupplierCode());
String name= odsProcureOrderMapper.selectBaseSupplier(odsProcureOrder);
qcCheckTaskIncomeDTO.setSupplierName(name);
@ -684,16 +684,16 @@ public class OdsProcureOrderServiceImpl implements IOdsProcureOrderService {
qcCheckTaskIncomeDTO.setPoolName("ds_" + odsProcureOrder.getFactoryCode());
qcCheckTaskIncomeDTO.setCheckLoc("mjtest");
qcCheckTaskIncomeDTO.setCheckType("checkTypeLL");
qcCheckTaskIncomeDTO.setCheckManCode("mobile");
qcCheckTaskIncomeDTO.setCheckManName("手持测试用户");
// qcCheckTaskIncomeDTO.setCheckManCode("mobile");
// qcCheckTaskIncomeDTO.setCheckManName("手持测试用户");
qcCheckTaskIncomeDTO.setSupplierCode("0000102272");
qcCheckTaskIncomeDTO.setFactoryCode("1000");
qcCheckTaskIncomeDTO.setSupplierName("广州市彩晴包装印刷有限公司");
qcCheckTaskIncomeDTO.setOrderType("bc");
qcCheckTaskIncomeDTO.setUnit("ST");
qcCheckTaskIncomeDTO.setUnit("KG");
qcCheckTaskIncomeDTO.setQuality(new BigDecimal("10"));
qcCheckTaskIncomeDTO.setMaterialCode("000000010900001055");
qcCheckTaskIncomeDTO.setMaterialName("榄菊植物力量蚊液33mL+送12mL*2瓶装纸盒(2201)");
qcCheckTaskIncomeDTO.setMaterialCode("000000020800001083");
qcCheckTaskIncomeDTO.setMaterialName("榄菊野菊花香型蚊香药液(0.08%R-05防霉配方)(2101版)");
qcCheckTaskIncomeDTO.setIncomeBatchNo("202312250001");
qcCheckTaskIncomeDTO.setOrderNo("4500297568");
qcCheckTaskIncomeDTO.setIncomeTime(new Date());

@ -1,6 +1,7 @@
package com.op.wms.service.impl;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -10,6 +11,8 @@ 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.system.api.RemoteQualityService;
import com.op.system.api.domain.quality.QcCheckTaskWarehousingDTO;
import com.op.system.api.domain.wms.wmsReportWork;
import com.op.system.api.RemoteSapService;
import com.op.wms.domain.*;
@ -19,6 +22,10 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import com.op.wms.service.IWmsProductPutService;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
* Service
@ -40,6 +47,8 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
private WmsFpStorageNewsMapper wmsFpStorageNewsMapper;
@Autowired
private RemoteSapService remoteSapService;
@Autowired
private RemoteQualityService remoteQualityService;
/**
*
*
@ -301,7 +310,7 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
@Override
@DS("#header.poolName")
public String addReportListSap(List<wmsReportWork> mesReportWorks) {
public String addReportListSap(List<wmsReportWork> mesReportWorks) throws ParseException {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
Date date = new Date();
String formattedDate = dateFormat.format(date);//批次
@ -309,6 +318,8 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
List<wmsReportWork> wmsReportWorkList=new ArrayList<>();
List<wmsReportWork> wmsReportWorkListRk=new ArrayList<>();
List<wmsReportWork> wmsReportWorkListagain=new ArrayList<>();
//获取当前所选工厂
for (wmsReportWork mesReportWork:
mesReportWorks) {
WmsProductPut wmsProductPutk=new WmsProductPut();
@ -353,138 +364,165 @@ public class WmsProductPutServiceImpl implements IWmsProductPutService {
wmsReportWorkListagain.add(mesReportWork);//再次过账
}
}
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<WmsProductPut> 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 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<WmsProductPut> 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<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);
// }
// }
// if(wmsReportWorkListRk.size()>0){
// List<Map<String, Object>> mapList = new ArrayList<>();
// for (wmsReportWork mesReportWork:
// wmsReportWorkListRk) {
// Map<String, Object> 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<Map<String, Object>> mapList = new ArrayList<>();
// for (wmsReportWork mesReportWork:
// wmsReportWorkListagain) {
// Map<String, Object> 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_","");
WmsFpStorageNews wmsFpStorageNews=new WmsFpStorageNews();
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());
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);
}
}
if(wmsReportWorkListRk.size()>0){
List<Map<String, Object>> mapList = new ArrayList<>();
for (wmsReportWork mesReportWork:
wmsReportWorkListRk) {
Map<String, Object> 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<Map<String, Object>> mapList = new ArrayList<>();
for (wmsReportWork mesReportWork:
wmsReportWorkListagain) {
Map<String, Object> 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);
}
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;
}

Loading…
Cancel
Save