|
|
@@ -784,21 +784,6 @@ public class MESServiceImpl implements MESService {
|
|
|
if (count2 <= 0) {
|
|
|
return ApiResponse.failRsp("10056", 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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
|
|
|
- //获取领料单拨出仓库
|
|
|
- int mmdetno = Integer.parseInt(StringUtil.nvl(baseDao.getFieldDataByCondition("MakeMaterial","mm_detno","mm_id in (" + lineId + ")"), "0"));
|
|
|
- Object data2 = baseDao.getFieldDataByCondition("prodiodetail", "min(pd_batchcode)","pd_piclass='生产领料单' and pd_ordercode='" + macode + "' and pd_orderdetno=" + mmdetno);
|
|
|
- Object pdwhcode = baseDao.getFieldDataByCondition("prodiodetail", "pd_whcode","pd_piclass='拨出单' and pd_batchcode='" + data2 + "'");
|
|
|
- int nocost = Integer.parseInt(StringUtil.nvl(baseDao.getFieldDataByCondition("Warehouse", "nvl(wh_nocost,0)", "wh_code='" + pdwhcode + "'"), "0"));
|
|
|
- int nocost1 = Integer.parseInt(StringUtil.nvl(baseDao.getFieldDataByCondition("Warehouse", "nvl(wh_nocost,0)", "wh_code='" + warehouses2[0] + "'"), "0"));
|
|
|
- if (nocost != nocost1) {
|
|
|
- if (nocost == -1) {
|
|
|
- return ApiResponse.failRsp("10058", requestId, "工单BOM领料仓是零值仓,不允许退有值仓!");
|
|
|
- }
|
|
|
- if (nocost == 0) {
|
|
|
- return ApiResponse.failRsp("10059", requestId, "工单BOM领料仓是有值仓,不允许退零值仓!");
|
|
|
- }
|
|
|
- }*/
|
|
|
}
|
|
|
}
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
|
@@ -892,11 +877,11 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
baseDao.execute(sqls);
|
|
|
baseDao.execute("delete from prodiodetail where pd_inqty=0 and pd_piclass='"+tlpiclass+"' and pd_piid="+tlid);
|
|
|
+ Employee employee = baseDao.getJdbcTemplate().queryForObject("select * from employee where em_code=?", new BeanPropertyRowMapper<Employee>(Employee.class), "mes");
|
|
|
int count = baseDao.getCount("select count(1) from prodiodetail where pd_piid=" + tlid);
|
|
|
if (count<=0){
|
|
|
baseDao.deleteById("prodinout","pi_id",tlid);
|
|
|
}
|
|
|
- Employee employee = baseDao.getJdbcTemplate().queryForObject("select * from employee where em_code=?", new BeanPropertyRowMapper<Employee>(Employee.class), "mes");
|
|
|
if (count>0) {
|
|
|
String s1 = postProdInOut(tlid, tlcaller, employee);
|
|
|
logger.info("S1==" + s1);
|
|
|
@@ -909,6 +894,9 @@ public class MESServiceImpl implements MESService {
|
|
|
if (s!=null){
|
|
|
return ApiResponse.successRsp("0",requestId,bcpiclass+":"+code+",过账失败,请在ERP重新过账!");
|
|
|
}
|
|
|
+ if (count<=0) {
|
|
|
+ return ApiResponse.successRsp("0",requestId,bcpiclass+":"+code+",请在ERP查看!");
|
|
|
+ }
|
|
|
return ApiResponse.successRsp("0",requestId,tlpiclass+":"+tlcode+","+bcpiclass+":"+code+",请在ERP查看!");
|
|
|
}
|
|
|
|
|
|
@@ -1340,17 +1328,6 @@ 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 + "'");
|
|
|
String ficmoBillNo = StringUtil.nvl(object.get("FICMOBillNo"), "");
|
|
|
- /* Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID2"), "{}"));
|
|
|
- String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
- if ("".equals(whcode2)){
|
|
|
- return ApiResponse.failRsp("10044",requestId,"发料仓库不能为空!");
|
|
|
- }
|
|
|
- int count2 = baseDao.getCount("select count(1) from customtabledetail left join customtable on cd_ctid=ct_id where ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
|
|
|
- if (count2<=0){
|
|
|
- return ApiResponse.failRsp("10045",requestId,"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
- }
|
|
|
- Object[] 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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
|
|
|
-*/
|
|
|
int lineId = Integer.parseInt(StringUtil.nvl(object.get("lineId"), "0"));
|
|
|
int count4 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
|
|
|
if (count4<=0){
|
|
|
@@ -1437,17 +1414,17 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
//退回仓库
|
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID1"), "{}"));
|
|
|
- String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
- if ("".equals(whcode2)) {
|
|
|
+ String whcode = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
+ if ("".equals(whcode)) {
|
|
|
return ApiResponse.failRsp("10055", requestId, "物料退回仓库不能为空!");
|
|
|
}
|
|
|
- int count2 = baseDao.getCount("select count(1) from customtabledetail left join customtable on cd_ctid=ct_id where ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
|
|
|
- if (count2 <= 0) {
|
|
|
+ int count = baseDao.getCount("select count(1) from customtabledetail left join customtable on cd_ctid=ct_id where ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
|
|
|
+ if (count <= 0) {
|
|
|
return ApiResponse.failRsp("10056", requestId, "MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- Object[] 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,wh_nocost", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
|
|
|
- Double outqty = Double.parseDouble(StringUtil.nvl(baseDao.getFieldDataByCondition("prodiodetail left join Warehouse on pd_whcode=wh_code", "sum(nvl(pd_outqty,0)-nvl(pd_inqty,0))", "pd_piclass in ("+piclass+ ") and pd_ordercode='" + macode + "' and pd_prodcode='" + itemNo + "' and nvl(wh_nocost,0)=" + warehouses2[2]),"0"));
|
|
|
+ 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,wh_nocost", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
|
|
|
+ Double outqty = Double.parseDouble(StringUtil.nvl(baseDao.getFieldDataByCondition("prodiodetail left join Warehouse on pd_whcode=wh_code", "sum(nvl(pd_outqty,0)-nvl(pd_inqty,0))", "pd_piclass in ("+piclass+ ") and pd_ordercode='" + macode + "' and pd_prodcode='" + itemNo + "' and nvl(wh_nocost,0)=" + warehouses[2]),"0"));
|
|
|
if (qty.compareTo(outqty) > 0) {
|
|
|
return ApiResponse.failRsp("10058", requestId, "退料数量不允许超过对应的发料数,请确定仓库属性和领料数量!");
|
|
|
}
|
|
|
@@ -1458,7 +1435,7 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
Object[] objs = baseDao.getFieldsDataByCondition("Make left join MakeMaterial on ma_id=mm_maid", new String[] { "mm_id", "mm_code","mm_detno", "mm_mdcode", "mm_prodcode", "mm_wccode"}, "mm_id in (" + lineId+")");
|
|
|
Object prid = baseDao.getFieldDataByCondition("Product", "pr_id", "pr_code='" + itemNo + "'");
|
|
|
- sqls.add("INSERT INTO ProdIODetail(pd_id, pd_piid, pd_inoutno, pd_piclass, pd_pdno, pd_status,pd_auditstatuscode,pd_auditstatus,pd_prodcode,pd_ordercode, pd_orderdetno,pd_macode,pd_madetno,pd_plancode, pd_wccode, pd_orderid, pd_prodid,pd_whcode,pd_whname,pd_inqty,pd_description) VALUES (PRODIODETAIL_SEQ.nextval,"+tlid+",'"+tlcode+"','"+tlpiclass+"',"+detno+ ",0,'ENTERING','在录入','"+itemNo+"','"+ficmoBillNo+"',"+objs[2]+",'"+ficmoBillNo+"',"+objs[2]+ ",'"+objs[3]+"','"+objs[5]+"',"+lineId+","+prid+",'"+warehouses2[0]+"','"+warehouses2[1]+"',"+qty+ ",'"+taskType+"')");
|
|
|
+ sqls.add("INSERT INTO ProdIODetail(pd_id, pd_piid, pd_inoutno, pd_piclass, pd_pdno, pd_status,pd_auditstatuscode,pd_auditstatus,pd_prodcode,pd_ordercode, pd_orderdetno,pd_macode,pd_madetno,pd_plancode, pd_wccode, pd_orderid, pd_prodid,pd_whcode,pd_whname,pd_inqty,pd_description) VALUES (PRODIODETAIL_SEQ.nextval,"+tlid+",'"+tlcode+"','"+tlpiclass+"',"+detno+ ",0,'ENTERING','在录入','"+itemNo+"','"+ficmoBillNo+"',"+objs[2]+",'"+ficmoBillNo+"',"+objs[2]+ ",'"+objs[3]+"','"+objs[5]+"',"+lineId+","+prid+",'"+warehouses[0]+"','"+warehouses[1]+"',"+qty+ ",'"+taskType+"')");
|
|
|
detno++;
|
|
|
}
|
|
|
sqls.add("update prodiodetail set (pd_mcid,pd_jobcode)=(select mc_id,mm_mdcode from MakeMaterial,makecraft where pd_orderdetno=mm_detno and pd_ordercode=mm_code and mm_mdcode=mc_code) where pd_piid="
|