|
|
@@ -68,14 +68,13 @@ public class MESServiceImpl implements MESService {
|
|
|
Object mesCode = StringUtil.nvl(jsonObject.get("mesCode"),"");
|
|
|
whcode= StringUtil.nvl(jsonObject.get("whNo"), "");
|
|
|
if ("".equals(mesCode)){
|
|
|
- return ApiResponse.failRsp("10011",request.getHeader("RequestId"),"MES编号不能为空!");
|
|
|
+ return ApiResponse.failRsp("10011",request.getHeader("RequestId"),"ERP单据编号不能为空!");
|
|
|
}
|
|
|
- int count = baseDao.getCountByCondition("verifyApply", "va_statuscode='AUDITED' and va_mescode='" + mesCode + "'");
|
|
|
+ int count = baseDao.getCountByCondition("verifyApply", "va_statuscode='AUDITED' and va_code='" + mesCode + "'");
|
|
|
if (count<1){
|
|
|
return ApiResponse.failRsp("10012",request.getHeader("RequestId"),"单据未审核或不存在,请确认!");
|
|
|
}
|
|
|
- vaid = baseDao.getFieldDataByCondition("verifyApply", "va_id", "va_statuscode='AUDITED" +
|
|
|
- "' and va_mescode='" + mesCode + "'");
|
|
|
+ vaid = baseDao.getFieldDataByCondition("verifyApply", "va_id", "va_statuscode='AUDITED' and va_code='" + mesCode + "'");
|
|
|
int count1 = baseDao.getCount("select count(1) from VerifyApplyDetail where nvl(vad_pucode,' ')<>' ' and " +
|
|
|
"vad_vaid=" + vaid);
|
|
|
if (count1>0){
|
|
|
@@ -210,6 +209,15 @@ public class MESServiceImpl implements MESService {
|
|
|
JSONObject jsonObject3 = JSON.parseObject(StringUtil.nvl(obj, ""));
|
|
|
Map<Object, Object> map11 = JSONUtil.toMap(StringUtil.valueOf(jsonObject3.get("FItemID")));
|
|
|
Map<Object, Object> map12 = JSONUtil.toMap(StringUtil.valueOf(jsonObject3.get("FDCStockID1")));
|
|
|
+ String whcode = StringUtil.nvl(map12.get("FNumber"), "");
|
|
|
+ if ("".equals(whcode)){
|
|
|
+ return ApiResponse.failRsp("10075",request.getHeader("RequestId"),"MES仓库编号不能为空!");
|
|
|
+ }
|
|
|
+ int count = baseDao.getCount("select count(1) from customtabledetail left join customtable on cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code where ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
|
|
|
+ if (count<=0){
|
|
|
+ return ApiResponse.failRsp("10076",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
+ }
|
|
|
+ Object[] warehouses = baseDao.getFieldsDataByCondition("customtabledetail left join customtable on cd_ctid=ct_id left join Warehouse on cd_varchar50_3=wh_code", "cd_varchar50_3,wh_description", "cd_varchar50_1='" + whcode + "'");
|
|
|
String fBatchNo = StringUtil.nvl(jsonObject3.get("FBatchNo"), "");
|
|
|
float fauxqty = jsonObject3.get("Fauxqty") == null ? 0 : Float.parseFloat(jsonObject3.get("Fauxqty").toString());
|
|
|
String fSecUnitID = StringUtil.nvl(jsonObject3.get("FSecUnitID"), "");
|
|
|
@@ -235,7 +243,7 @@ public class MESServiceImpl implements MESService {
|
|
|
"pd_total,pd_whcode,pd_whname,pd_remark,pd_prodmadedate,pd_replydate,pd_location,pd_macode) " +
|
|
|
"values (PRODIODETAIL_SEQ.nextval,"+id+",'"+code+"','完工入库单',"+detno+",'"+fSourceBillNo+
|
|
|
"','"+map11.get("FNumber")+"','"+fBatchNo+"',"+fauxqty+",'"+fSecUnitID+"',"+fSecCoefficient+","+fSecQty+","+fAuxPlanPrice+","+fPlanAmount+","+fauxprice+"," +
|
|
|
- ""+famount+",'"+map12.get("FNumber")+"','"+map12.get("FName")+"','"+fnote+"',to_date('"+fEntrySelfA0248+"'," +
|
|
|
+ ""+famount+",'"+warehouses[0]+"','"+warehouses[1]+"','"+fnote+"',to_date('"+fEntrySelfA0248+ "'," +
|
|
|
"'yyyy-MM-dd HH24:mi:ss'),to_date('"+fPeriodDate+"','yyyy-MM-dd HH24:mi:ss'),'"+location+"','"+fICMOBillNo+"')");
|
|
|
detno++;
|
|
|
}
|
|
|
@@ -657,6 +665,16 @@ public class MESServiceImpl implements MESService {
|
|
|
return ApiResponse.successRsp("0",request.getHeader("RequestId"),"拨出单:"+code+",请在ERP查看!");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ApiResult<String> makeCheckOutStock(HttpServletRequest request) {
|
|
|
+ JSONObject jsonData = getJsonData(request);
|
|
|
+ String msg = baseDao.callProcedure("USER_CHECKOUTSTOCK", new Object[]{"", jsonData});
|
|
|
+ if (msg != null && !msg.trim().equals("")){
|
|
|
+ return ApiResponse.failRsp("10071",request.getHeader("RequestId"),msg);
|
|
|
+ }
|
|
|
+ return ApiResponse.successRsp("0",request.getHeader("RequestId"),"校验通过!");
|
|
|
+ }
|
|
|
+
|
|
|
private Map<String, JSONArray> getData(HttpServletRequest request){
|
|
|
Map<String, JSONArray> map = new HashMap<>();
|
|
|
try {
|