|
|
@@ -136,10 +136,10 @@ public class MESServiceImpl implements MESService {
|
|
|
Double vadQty = baseDao.getSummaryByField("verifyapplydetail", "vad_qty", "vad_prodcode='" + itemNo + "' and vad_vaid=" + vaid);
|
|
|
int compare = qty.compareTo(vadQty);
|
|
|
if (compare>0){
|
|
|
- return ApiResponse.failRsp("10017",request.getHeader("RequestId"),"收料数量:"+qty+"超出ERP收料单数量:"+vadQty+",不允许入库!");
|
|
|
+ return ApiResponse.failRsp("10017",request.getHeader("RequestId"), "物料:"+itemNo+",收料数量:"+qty+"超出ERP收料单数量:"+vadQty+ ",不允许入库!");
|
|
|
}
|
|
|
if (compare<0){
|
|
|
- return ApiResponse.failRsp("10018",request.getHeader("RequestId"),"收料数量:"+qty+"少于ERP收料单数量:"+vadQty+",不允许入库!");
|
|
|
+ return ApiResponse.failRsp("10018",request.getHeader("RequestId"),"物料:"+itemNo+",收料数量:"+qty+"少于ERP收料单数量:"+vadQty+",不允许入库!");
|
|
|
}
|
|
|
}
|
|
|
if ("".equals(whcode)){
|
|
|
@@ -152,7 +152,7 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
|
|
|
|
|
|
- int piid ;
|
|
|
+ int piid =0;
|
|
|
Employee employee = baseDao.getJdbcTemplate().queryForObject("select * from employee where em_name=?",
|
|
|
new BeanPropertyRowMapper<Employee>(Employee.class), sellerName);
|
|
|
// 转采购验收单
|
|
|
@@ -205,16 +205,17 @@ public class MESServiceImpl implements MESService {
|
|
|
"pu_turnstatuscode='" + statuscode + "',pu_turnstatus='" + status + "'", "pu_code='" + pCode + "'");
|
|
|
}
|
|
|
}
|
|
|
+ // 修改收料状态
|
|
|
+ baseDao.updateByCondition("VerifyApplyDetail", "vad_yqty=vad_qty", "vad_vaid=" + vaid);
|
|
|
+ baseDao.updateByCondition("VerifyApply", "va_turnstatuscode='TURNIN',va_turnstatus='已入库'", "va_id=" + vaid);
|
|
|
+ String s = postProdInOut(piid, djcaller, employee);
|
|
|
+ logger.info("收料单入库=="+s);
|
|
|
+ if (s!=null){
|
|
|
+ return ApiResponse.successRsp("0",request.getHeader("RequestId"),type+":"+key.getCode()+",过账失败,请在ERP重新过账!");
|
|
|
+ }
|
|
|
+ return ApiResponse.successRsp("0",request.getHeader("RequestId"),type+":"+key.getCode()+",请在ERP查看!");
|
|
|
}
|
|
|
- // 修改收料状态
|
|
|
- baseDao.updateByCondition("VerifyApplyDetail", "vad_yqty=vad_qty", "vad_vaid=" + vaid);
|
|
|
- baseDao.updateByCondition("VerifyApply", "va_turnstatuscode='TURNIN',va_turnstatus='已入库'", "va_id=" + vaid);
|
|
|
- String s = postProdInOut(piid, djcaller, employee);
|
|
|
- System.err.println(s);
|
|
|
- if (s!=null){
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),type+":"+key.getCode()+",过账失败,请在ERP重新过账!");
|
|
|
- }
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),type+":"+key.getCode()+",请在ERP查看!");
|
|
|
+ return ApiResponse.failRsp("10019",request.getHeader("RequestId"),"ERP生成单据失败!");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -658,10 +659,13 @@ public class MESServiceImpl implements MESService {
|
|
|
JSONArray array = data.get("detail");
|
|
|
if(array!=null&&array.size()>0){
|
|
|
String macode = StringUtil.valueOf(JSON.parseObject(StringUtil.nvl(array.get(0), "{}")).get("FICMOBillNo"));
|
|
|
- ma_tasktype = StringUtil.nvl(baseDao.getFieldDataByCondition("Make", "ma_tasktype",
|
|
|
- "ma_code in ('" + macode + "')"),"");
|
|
|
- maid = Integer.parseInt(StringUtil.nvl(baseDao.getFieldDataByCondition("Make", "ma_id",
|
|
|
- "ma_code in ('" + macode + "')"),"0"));
|
|
|
+ Object[] data1 = baseDao.getFieldsDataByCondition("Make", "ma_tasktype,ma_id", "ma_code in ('" + macode + "')");
|
|
|
+ if (data1!=null&&data1.length>0) {
|
|
|
+ ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
|
+ maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
|
+ }else {
|
|
|
+ return ApiResponse.failRsp("10057", request.getHeader("RequestId"), "工单在ERP不存在,请核对!");
|
|
|
+ }
|
|
|
}
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
|
Object obj = jsonArray.get(i);
|
|
|
@@ -728,7 +732,7 @@ public class MESServiceImpl implements MESService {
|
|
|
"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='" + whcode2 + "'");
|
|
|
if (count2<=0){
|
|
|
- return ApiResponse.failRsp("10074",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
+ return ApiResponse.failRsp("10056",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
warehouses2 = 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",
|
|
|
@@ -754,14 +758,10 @@ public class MESServiceImpl implements MESService {
|
|
|
"pd_whcode,pd_whname) VALUES ("+seqId+","+tlid+",'"+tlcode+"','"+tlpiclass+"',"+det+"," +
|
|
|
"0,'ENTERING','在录入','"+itemNo+"','"+ficmoBillNo+"',"+objs[2]+",'"+ficmoBillNo+"',"+objs[2]+",'"+objs[3]+"','"+objs[5]+"',"+lineId+","+prid+",'"+warehouses[0]+"','"+warehouses[1]+"')");
|
|
|
det++;
|
|
|
- sqls.add("update prodiodetail set pd_inqty=(select nvl(mm_havegetqty,0)-nvl(ma_tomadeqty,0)*nvl" +
|
|
|
- "(mm_oneuseqty,0) from MakeMaterial left join Make on ma_id=mm_maid where mm_id="+objs[0]+") " +
|
|
|
- "where pd_id="+seqId);
|
|
|
+ sqls.add("update prodiodetail set pd_inqty=(select nvl(mm_totaluseqty,0)-nvl(ma_tomadeqty,0)*nvl(mm_oneuseqty,0) from MakeMaterial left join Make on ma_id=mm_maid where mm_id="+objs[0]+") where pd_id="+seqId);
|
|
|
|
|
|
}
|
|
|
- sqls.add("insert into prodiodetail (pd_id,pd_piid,pd_inoutno,pd_piclass,pd_pdno,pd_prodcode," +
|
|
|
- "pd_outqty,pd_whcode,pd_whname,pd_inwhcode,pd_inwhname,pd_macode,pd_madetno) " +
|
|
|
- "values (PRODIODETAIL_SEQ.nextval,"+id+",'"+code+"','"+bcpiclass+"',"+detno+",'"+itemNo+"',"+qty+",'"+warehouses[0]+"','"+warehouses[1]+"','"+warehouses2[0]+"','"+warehouses2[1]+"','"+ficmoBillNo+"',"+objs[2]+")");
|
|
|
+ sqls.add("insert into prodiodetail (pd_id,pd_piid,pd_inoutno,pd_piclass,pd_pdno,pd_prodcode,pd_outqty,pd_whcode,pd_whname,pd_inwhcode,pd_inwhname,pd_macode,pd_madetno) values (PRODIODETAIL_SEQ.nextval,"+id+",'"+code+"','"+bcpiclass+"',"+detno+",'"+itemNo+"',"+qty+",'"+warehouses[0]+"','"+warehouses[1]+"','"+warehouses2[0]+"','"+warehouses2[1]+"','"+ficmoBillNo+"',"+objs[2]+")");
|
|
|
detno++;
|
|
|
}
|
|
|
if (frob==0){
|