update MES物料消耗接口,修改SAP过账日期报文
This commit is contained in:
parent
7176a2a3bf
commit
136d0b16a4
@ -2609,7 +2609,7 @@ public class ToSAPServiceImpl {
|
|||||||
//过账日期
|
//过账日期
|
||||||
body.put("BUDAT", budatData);
|
body.put("BUDAT", budatData);
|
||||||
//凭证日期
|
//凭证日期
|
||||||
body.put("BLDAT", TimeStampUtil.getCurrentTime("yyyyMMdd"));
|
body.put("BLDAT", budatData);
|
||||||
//凭证抬头文本
|
//凭证抬头文本
|
||||||
body.put("BKTXT", uniqueID);
|
body.put("BKTXT", uniqueID);
|
||||||
//用户名
|
//用户名
|
||||||
|
@ -15,9 +15,11 @@ import com.cim.idm.mwmsextend.materialpacking.service.MaterialPackingServiceUtil
|
|||||||
import com.cim.idm.mwmsextend.materialshiprequest.service.MaterialShipRequestServiceImpl;
|
import com.cim.idm.mwmsextend.materialshiprequest.service.MaterialShipRequestServiceImpl;
|
||||||
import com.cim.idm.service.ChargeSplitService;
|
import com.cim.idm.service.ChargeSplitService;
|
||||||
import com.cim.idm.service.InvoiceService;
|
import com.cim.idm.service.InvoiceService;
|
||||||
|
import com.cim.idm.service.QMSService;
|
||||||
import com.cim.idm.service.impl.MESServiceImpl;
|
import com.cim.idm.service.impl.MESServiceImpl;
|
||||||
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
import com.cim.idm.service.impl.ToSAPServiceImpl;
|
||||||
import com.cim.idm.util.MessageLogUtil;
|
import com.cim.idm.util.MessageLogUtil;
|
||||||
|
import com.cim.idm.util.NCHttpUtil;
|
||||||
import com.cim.idm.util.ToSAPMessageUtil;
|
import com.cim.idm.util.ToSAPMessageUtil;
|
||||||
import com.cim.idm.utils.AjaxResult;
|
import com.cim.idm.utils.AjaxResult;
|
||||||
import com.cim.idm.utils.CodeGenerator;
|
import com.cim.idm.utils.CodeGenerator;
|
||||||
@ -39,7 +41,9 @@ import com.cim.idm.wmspackage.materialreceivetactdetail.management.data.Material
|
|||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||||
import groovy.lang.Lazy;
|
import groovy.lang.Lazy;
|
||||||
|
import io.micrometer.core.instrument.util.StringUtils;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
import org.quartz.SimpleTrigger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -58,7 +62,8 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ToSAPServiceImpl toSAPService;
|
private ToSAPServiceImpl toSAPService;
|
||||||
|
@Autowired
|
||||||
|
private QMSService qmsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@Lazy
|
@Lazy
|
||||||
private ChargeSplitService chargeSplitService;
|
private ChargeSplitService chargeSplitService;
|
||||||
@ -3433,6 +3438,11 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
// billCode=toSAPService.saleStockOut_NEW(shipRequestName, "SDK", eventUser,materialPackingKeyList);
|
// billCode=toSAPService.saleStockOut_NEW(shipRequestName, "SDK", eventUser,materialPackingKeyList);
|
||||||
billCode=saleStockOut_NEW(shipRequestName, "SDK", eventUser,materialPackingKeyList,commitDate);
|
billCode=saleStockOut_NEW(shipRequestName, "SDK", eventUser,materialPackingKeyList,commitDate);
|
||||||
untils.SaveUnDoInfo_ForSap(materialPackingKeyList, billCode, makeEventInfo);
|
untils.SaveUnDoInfo_ForSap(materialPackingKeyList, billCode, makeEventInfo);
|
||||||
|
//单据类型等于ZLF0-ZLF9,物料编码以7开头都属于成品胶水需要调用QMS质检接口
|
||||||
|
String message = checkShipRequestTypeSendIQC(commitDate, siteName ,shipRequestName, makeEventInfo, materialPackingKeyList);
|
||||||
|
if (StringUtils.isNotEmpty(message)) {
|
||||||
|
throw new CustomException(message);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "08": // 委外
|
case "08": // 委外
|
||||||
case "OEM": // 委外
|
case "OEM": // 委外
|
||||||
@ -3568,4 +3578,99 @@ public class InvoiceServiceImpl implements InvoiceService {
|
|||||||
String sendData = MainData.toJSONString();
|
String sendData = MainData.toJSONString();
|
||||||
return sendData;
|
return sendData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String checkShipRequestTypeSendIQC(String shippingDate,String siteName, String shipRequestName, EventInfo eventInfo, List<String> materialPackingNameList) throws Exception {
|
||||||
|
String message = "";
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
Map<String, JSONObject> jsonObjectMap = new HashMap<>();
|
||||||
|
String sql=" SELECT \n" +
|
||||||
|
"MP.SITENAME,\n" +
|
||||||
|
"MP.SHIPREQUESTNAME,\n" +
|
||||||
|
"MP.MATERIALSPECNAME,\n" +
|
||||||
|
"MP.MATERIALPACKINGNAME,\n" +
|
||||||
|
"MP.REMARK,\n" +
|
||||||
|
"MP.CHARGE,\n" +
|
||||||
|
"MP.SDKTRUEID,\n" +
|
||||||
|
"MS.DESC_CN\n" +
|
||||||
|
"FROM\n" +
|
||||||
|
"MATERIALPACKING MP \n" +
|
||||||
|
"LEFT JOIN MATERIALSPEC MS ON MP.SITENAME = MS.SITENAME AND MP.MATERIALSPECNAME = MS.MATERIALSPECNAME\n" +
|
||||||
|
"WHERE\n" +
|
||||||
|
"MP.SITENAME =:SITENAME\n" +
|
||||||
|
"AND MP.SHIPREQUESTNAME =:SHIPREQUESTNAME\n" +
|
||||||
|
"AND MP.MATERIALPACKINGNAME IN (:BOXLIST)\n" +
|
||||||
|
"AND MP.MATERIALSPECNAME LIKE '7%' ";
|
||||||
|
|
||||||
|
Map<String, Object> hashMap = new HashMap<String, Object>();
|
||||||
|
hashMap.put("SHIPREQUESTNAME", shipRequestName);
|
||||||
|
hashMap.put("SITENAME", siteName);
|
||||||
|
hashMap.put("BOXLIST", materialPackingNameList);
|
||||||
|
List<Map<String, Object>> queryForList = IDMFrameServiceProxy.getSqlTemplate().queryForList(sql.toString(), hashMap);
|
||||||
|
if (!queryForList.isEmpty()){
|
||||||
|
|
||||||
|
for (int i = 0; i < queryForList.size(); i++) {
|
||||||
|
String source = "wms";
|
||||||
|
String deliveryNumber = queryForList.get(i).get("SHIPREQUESTNAME") == null ? "" : queryForList.get(i).get("SHIPREQUESTNAME").toString();
|
||||||
|
String materialCode = queryForList.get(i).get("MATERIALSPECNAME") == null ? "" : queryForList.get(i).get("MATERIALSPECNAME").toString();
|
||||||
|
String materialName = queryForList.get(i).get("DESC_CN") == null ? "" : queryForList.get(i).get("DESC_CN").toString();
|
||||||
|
String specification = queryForList.get(i).get("SDKTRUEID") == null ? "" : queryForList.get(i).get("SDKTRUEID").toString();
|
||||||
|
String materialPackingName = queryForList.get(i).get("MATERIALPACKINGNAME") == null ? "" : queryForList.get(i).get("MATERIALPACKINGNAME").toString();
|
||||||
|
if (jsonObjectMap.containsKey(materialName)){
|
||||||
|
JSONObject jsonObject = jsonObjectMap.get(materialName);
|
||||||
|
String shipmentBatch = jsonObject.getString("shipmentBatch");
|
||||||
|
jsonObject.put("shipmentBatch",shipmentBatch + "," + materialPackingName);
|
||||||
|
}else {
|
||||||
|
JSONObject jsonObject = new JSONObject(true);
|
||||||
|
//必传字段
|
||||||
|
jsonObject.put("source", source);
|
||||||
|
//出货日期,取页面上的过账日期
|
||||||
|
jsonObject.put("shippingDate", shippingDate);
|
||||||
|
// 发货单号
|
||||||
|
jsonObject.put("deliveryNumber", deliveryNumber);
|
||||||
|
// 料号
|
||||||
|
jsonObject.put("materialCode", materialCode);
|
||||||
|
// 发货品名
|
||||||
|
jsonObject.put("materialName", materialName);
|
||||||
|
// 规格
|
||||||
|
jsonObject.put("specification", specification);
|
||||||
|
//发货批次号
|
||||||
|
jsonObject.put("shipmentBatch", materialPackingName);
|
||||||
|
jsonObjectMap.put(materialName, jsonObject);
|
||||||
|
//非必传字段
|
||||||
|
/**
|
||||||
|
* String inspectionNumber = queryForList.get(i).get("SHIPREQUESTNAME") == null ? "" : queryForList.get(i).get("SHIPREQUESTNAME").toString();
|
||||||
|
* String quantity = queryForList.get(i).get("MATERIALQUANTITY") == null ? "" : queryForList.get(i).get("MATERIALQUANTITY").toString();
|
||||||
|
* String inspectBatch = queryForList.get(i).get("CHARGE") == null ? "" : queryForList.get(i).get("CHARGE").toString();
|
||||||
|
* String samplingQuantity = queryForList.get(i).get("") == null ? "" : queryForList.get(i).get("").toString();
|
||||||
|
* String samplingSpecification = queryForList.get(i).get("") == null ? "" : queryForList.get(i).get("").toString();
|
||||||
|
* String remark = queryForList.get(i).get("REMARK") == null ? "" : queryForList.get(i).get("REMARK").toString();
|
||||||
|
* String materialGroup = queryForList.get(i).get("MATERIALPROCESSGROUPNAME") == null ? "" : queryForList.get(i).get("MATERIALPROCESSGROUPNAME").toString();
|
||||||
|
// 发货数量
|
||||||
|
jsonObject.put("quantity", quantity);
|
||||||
|
// 客户名称
|
||||||
|
jsonObject.put("customName", customName);
|
||||||
|
// 客户代码
|
||||||
|
jsonObject.put("customCode", customCode);
|
||||||
|
// 检验单号
|
||||||
|
jsonObject.put("inspectionNumber", inspectionNumber);
|
||||||
|
//检验批号
|
||||||
|
jsonObject.put("inspectBatch", inspectBatch);
|
||||||
|
|
||||||
|
// 抽检数量
|
||||||
|
jsonObject.put("samplingQuantity", samplingQuantity);
|
||||||
|
// 抽检规格
|
||||||
|
jsonObject.put("samplingSpecification", samplingSpecification);
|
||||||
|
// 备注
|
||||||
|
jsonObject.put("remark", remark);
|
||||||
|
// 物料组
|
||||||
|
jsonObject.put("materialGroup", materialGroup);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonArray.addAll(jsonObjectMap.values());
|
||||||
|
String jsonArrayJSONString = jsonArray.toJSONString();
|
||||||
|
message = qmsService.sendQMSByUrlJson(jsonArrayJSONString, "/opc/addShipmentInspection",eventInfo);
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user