|
|
@@ -41,13 +41,14 @@ public class MESServiceImpl implements MESService {
|
|
|
if ("".equals(mesCode)){
|
|
|
return ApiResponse.failRsp("10011",request.getHeader("RequestId"),"MES编号不能为空!");
|
|
|
}
|
|
|
- VerifyApply verifyApply = baseDao.getJdbcTemplate().queryForObject("select va_id,va_mescode,va_code,to_char(va_date,'yyyy-MM-dd HH24:mi:ss') va_date,va_vendcode,va_vendname,va_currency,va_rate,va_paymentscode,va_payments,va_transport,va_sendcode,va_emcode,va_emname,wh_mesc_user va_whcode,wh_mesn_user va_whname,va_departmentcode,va_department,va_recorder,nvl(va_cop,'BYT') va_cop,va_remark,va_ancode,va_factory,0 version,va_custcode,va_custname,va_type,va_pucode,case when nvl(va_pucode,' ')=' ' then 0 else (select pu_id from purchase where pu_code=va_pucode) end pu_id,va_status,1 posted,to_char(va_auditdate,'yyyy-MM-dd HH24:mi:ss') va_auditdate,va_auditman " +
|
|
|
- "from VerifyApply left join Warehouse on va_whcode=wh_code where va_statuscode='AUDITED' and va_mescode=?",
|
|
|
+ VerifyApply verifyApply = baseDao.getJdbcTemplate().queryForObject("select va_id,va_mescode,va_code,to_char(va_date,'yyyy-MM-dd HH24:mi:ss') va_date,va_vendcode,va_vendname,va_currency,va_rate,va_paymentscode,va_payments,va_transport,va_sendcode,va_emcode,va_emname,va_departmentcode,va_department,va_recorder,nvl(va_cop,'BYT') va_cop,va_remark,va_ancode,va_factory,0 version,va_type,va_pucode,case when nvl(va_pucode,' ')=' ' then 0 else (select pu_id from purchase where pu_code=va_pucode) end pu_id,va_status,1 posted,to_char(va_auditdate,'yyyy-MM-dd HH24:mi:ss') va_auditdate,va_auditman " +
|
|
|
+ "from VerifyApply where va_statuscode='AUDITED' and va_mescode=?",
|
|
|
new BeanPropertyRowMapper<VerifyApply>(VerifyApply.class), mesCode);
|
|
|
if (verifyApply==null) {
|
|
|
return ApiResponse.failRsp("10012",request.getHeader("RequestId"),"单据未审核或不存在,请确认!");
|
|
|
}
|
|
|
- List<VerifyApplyDetail> verifyApplyDetails = baseDao.query("select vad_code,vad_prodcode,pr_detail,pr_spec,pr_unit,sum(nvl(vad_qty,0)) vad_qty from verifyapplydetail left join product on vad_prodcode=pr_code where vad_vaid=" + verifyApply.getVa_id() + " group by vad_code,vad_prodcode,pr_detail,pr_spec,pr_unit", VerifyApplyDetail.class);
|
|
|
+ List<VerifyApplyDetail> verifyApplyDetails = baseDao.query("select vad_code,vad_prodcode,pr_detail,pr_spec,pr_unit,va_recorder,va_date,pr_kh_user,cu_name,sum(nvl(vad_qty,0)) vad_qty from ( select vad_code,vad_prodcode,pr_detail,pr_spec,pr_unit,vad_qty,va_recorder,to_char(va_date,'yyyy-MM-dd HH24:mi:ss') va_date,case when pr_kh_user='柏英特' or nvl(pr_kh_user,' ')=' ' then 'BYT' else nvl(cu_mescode,cu_code) end pr_kh_user,cu_name from verifyapplydetail left join VerifyApply on va_id=vad_vaid left join product on vad_prodcode=pr_code " +
|
|
|
+ "left join customer on cu_shortname=pr_kh_user where vad_vaid="+verifyApply.getVa_id()+") group by vad_code,vad_prodcode,pr_detail,pr_spec,pr_unit,va_recorder,va_date,pr_kh_user,cu_name", VerifyApplyDetail.class);
|
|
|
verifyApply.setDetail(verifyApplyDetails);
|
|
|
String s = JSON.toJSONString(verifyApply, SerializerFeature.WriteMapNullValue);
|
|
|
return ApiResponse.successRsp("0","获取成功!",request.getHeader("RequestId"),s);
|
|
|
@@ -61,9 +62,11 @@ public class MESServiceImpl implements MESService {
|
|
|
String caller="VerifyApply!ToOtherIn";
|
|
|
String type="其它入库单";
|
|
|
String sellerName="";
|
|
|
+ String whcode="";
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
|
JSONObject jsonObject = JSON.parseObject(StringUtil.nvl(jsonArray.get(i), ""));
|
|
|
Object mesCode = StringUtil.nvl(jsonObject.get("mesCode"),"");
|
|
|
+ whcode= StringUtil.nvl(jsonObject.get("whNo"), "");
|
|
|
if ("".equals(mesCode)){
|
|
|
return ApiResponse.failRsp("10011",request.getHeader("RequestId"),"MES编号不能为空!");
|
|
|
}
|
|
|
@@ -102,6 +105,16 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
sellerName = StringUtil.nvl(jsonObject.get("sellerName"), "管理员");
|
|
|
}
|
|
|
+ if ("".equals(whcode)){
|
|
|
+ return ApiResponse.failRsp("10015",request.getHeader("RequestId"),"MES仓库编号不能为空!");
|
|
|
+ }
|
|
|
+ int coun = 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 (coun<=0){
|
|
|
+ return ApiResponse.failRsp("10016",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 + "'");
|
|
|
+
|
|
|
int piid ;
|
|
|
Employee employee = baseDao.getJdbcTemplate().queryForObject("select * from employee where em_name=?",
|
|
|
new BeanPropertyRowMapper<Employee>(Employee.class), sellerName);
|
|
|
@@ -110,22 +123,21 @@ public class MESServiceImpl implements MESService {
|
|
|
piid = key.getId();
|
|
|
// 转入明细
|
|
|
transferRepository.transferDetail(caller, vaid, key,employee);
|
|
|
- if ("VerifyApply!ToPurcIn".equals(caller)) {
|
|
|
- if (piid != 0) {
|
|
|
- baseDao.execute("update prodiodetail set pd_prodid=(select pr_id from product where pd_prodcode=pr_code) where pd_piid=" + piid
|
|
|
- + " and nvl(pd_prodcode,' ')<>' '");
|
|
|
- baseDao.execute("update prodiodetail set pd_whid=(select wh_id from warehouse where wh_code=pd_whcode) where pd_piid=" + piid
|
|
|
- + " and nvl(pd_whcode,' ')<>' '");
|
|
|
- baseDao.updateByCondition("ProdInOut",
|
|
|
- "pi_total=(SELECT round(sum(nvl(pd_orderprice,0)*(nvl(pd_inqty,0)+nvl(pd_outqty,0))),2) FROM ProdIODetail WHERE pd_piid="
|
|
|
- + piid + ")", "pi_id=" + piid);
|
|
|
- baseDao.updateByCondition("ProdInOut", "pi_totalupper=L2U(nvl(pi_total,0))", "pi_id=" + piid);
|
|
|
+ if (piid != 0) {
|
|
|
+ baseDao.updateByCondition("prodiodetail", "pd_whcode='"+warehouses[0]+"',pd_whname='"+warehouses[1]+"'", "pd_piid=" + piid);
|
|
|
+ baseDao.updateByCondition("prodinout", "pi_whcode='"+warehouses[0]+"',pi_whname='"+warehouses[1]+"'", "pi_id=" + piid);
|
|
|
+ baseDao.execute("update prodiodetail set pd_prodid=(select pr_id from product where pd_prodcode=pr_code) where pd_piid=" + piid
|
|
|
+ + " and nvl(pd_prodcode,' ')<>' '");
|
|
|
+ baseDao.execute("update prodiodetail set pd_whid=(select wh_id from warehouse where wh_code=pd_whcode) where pd_piid=" + piid
|
|
|
+ + " and nvl(pd_whcode,' ')<>' '");
|
|
|
+ baseDao.updateByCondition("ProdInOut",
|
|
|
+ "pi_total=(SELECT round(sum(nvl(pd_orderprice,0)*(nvl(pd_inqty,0)+nvl(pd_outqty,0))),2) FROM ProdIODetail WHERE pd_piid="
|
|
|
+ + piid + ")", "pi_id=" + piid);
|
|
|
+ baseDao.updateByCondition("ProdInOut", "pi_totalupper=L2U(nvl(pi_total,0))", "pi_id=" + piid);
|
|
|
+ if ("VerifyApply!ToPurcIn".equals(caller)) {
|
|
|
baseDao.execute("Insert into ProdChargeDetail(pd_id,pd_piid,pd_detno,pd_type,pd_amount,pd_currency,pd_rate) "
|
|
|
+ "select ProdChargeDetail_seq.nextval, " + piid + ", pd_detno, pd_type,pd_amount,pd_currency,pd_rate "
|
|
|
+ "from ProdChargeDetailAN where PD_ANID=" + vaid);
|
|
|
- }
|
|
|
- //
|
|
|
- if (piid != 0) {
|
|
|
SqlRowList rs = baseDao.queryForRowSet("select vad_pucode,vad_pudetno,vad_qty from VerifyApplyDetail where vad_vaid=" + vaid);
|
|
|
String pCode = null;
|
|
|
int pDetno = 0;
|
|
|
@@ -182,11 +194,11 @@ public class MESServiceImpl implements MESService {
|
|
|
if ("".equals(whcode)){
|
|
|
return ApiResponse.failRsp("10073",request.getHeader("RequestId"),"MES仓库编号不能为空!");
|
|
|
}
|
|
|
- int count = baseDao.getCount("select count(1) from Warehouse where wh_mesc_user='" + whcode + "'");
|
|
|
+ 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("10074",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- Object[] warehouses = baseDao.getFieldsDataByCondition("Warehouse", "wh_code,wh_description", "wh_mesc_user='" + whcode + "'");
|
|
|
+ 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 + "'");
|
|
|
id = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
|
code = baseDao.sGetMaxNumber("ProdInOut!Make!In", 2);
|
|
|
sqls.add("insert into prodinout (pi_id,pi_inoutno,pi_class,pi_date,pi_statuscode,pi_status,pi_whcode,pi_whname,pi_departmentcode,pi_departmentname,pi_emcode,pi_emname,pi_invostatuscode,pi_invostatus,pi_recordman,pi_recorddate,pi_printstatuscode,pi_printstatus) values ("+id+",'"+code+"','完工入库单',to_date('"+jsonObject2.get("Fdate")+"','yyyy/MM/dd HH24:mi:ss'),'UNPOST'," + "'未过账','"+warehouses[0]+"','"+warehouses[1]+"','"+map5.get("FNumber")+"','"+map5.get("FName")+ "','"+map6.get("FNumber")+"','"+map7.get("FName")+"','ENTERING','在录入','"+map8.get("FName")+"',to_date('"+jsonObject2.get("Fdate")+"','yyyy/MM/dd HH24:mi:ss'),'UNPRINT','未打印')");
|
|
|
@@ -366,11 +378,11 @@ public class MESServiceImpl implements MESService {
|
|
|
if ("".equals(whcode)){
|
|
|
return ApiResponse.failRsp("10034",request.getHeader("RequestId"),"MES仓库编号不能为空!");
|
|
|
}
|
|
|
- int count = baseDao.getCount("select count(1) from Warehouse where wh_mesc_user='" + whcode + "'");
|
|
|
+ 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("10035",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- Object[] warehouses = baseDao.getFieldsDataByCondition("Warehouse", "wh_code,wh_description", "wh_mesc_user='" + whcode + "'");
|
|
|
+ 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 + "'");
|
|
|
sqls.add("insert into prodiodetail (pd_id,pd_piid,pd_inoutno,pd_piclass,pd_pdno,pd_prodcode," +
|
|
|
"pd_outqty,pd_whcode,pd_whname,pd_remark) " +
|
|
|
"values (PRODIODETAIL_SEQ.nextval,"+id+",'"+code+"','其它出库单',"+detno+",'"+itemNo+
|
|
|
@@ -429,12 +441,13 @@ public class MESServiceImpl implements MESService {
|
|
|
// 标示领料单的拨出单号
|
|
|
baseDao.execute("update ProdInOut set pi_fromcode='" + bccode + "' where pi_id=" + llpiid);
|
|
|
}
|
|
|
- Object mmwhcode = baseDao.getFieldDataByCondition("MakeMaterial", "min(mm_whcode)", " nvl(mm_whcode,' ')<>' '" + " and mm_code in ('" + macode + "')");
|
|
|
+ /*Object mmwhcode = baseDao.getFieldDataByCondition("MakeMaterial", "min(mm_whcode)", " nvl(mm_whcode,' ')<>' '" + " and mm_code in ('" + macode + "')");
|
|
|
Object mmwhname="";
|
|
|
if (mmwhcode!=null&&!"".equals(mmwhcode.toString())){
|
|
|
mmwhname = baseDao.getFieldDataByCondition("warehouse", "min(wh_description)",
|
|
|
"wh_code in ('" + mmwhcode + "'");
|
|
|
- }
|
|
|
+ }*/
|
|
|
+
|
|
|
JSONArray array = data.get("detail");
|
|
|
int detno=1;
|
|
|
for (int i = 0; i <array.size(); i++) {
|
|
|
@@ -454,20 +467,36 @@ public class MESServiceImpl implements MESService {
|
|
|
if ("".equals(whcode)){
|
|
|
return ApiResponse.failRsp("10043",request.getHeader("RequestId"),"发料仓库不能为空!");
|
|
|
}
|
|
|
- int count = baseDao.getCount("select count(1) from Warehouse where wh_mesc_user='" + whcode + "'");
|
|
|
+ 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("10044",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- Object[] warehouses = baseDao.getFieldsDataByCondition("Warehouse", "wh_code,wh_description", "wh_mesc_user='" + whcode + "'");
|
|
|
+ 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 fSourceInterId = StringUtil.nvl(object.get("FSourceInterId"), "");
|
|
|
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"), "");
|
|
|
+ String whname2 = StringUtil.nvl(map2.get("FName"), "");
|
|
|
+ if ("".equals(whcode2)){
|
|
|
+ return ApiResponse.failRsp("10043",request.getHeader("RequestId"),"物料所在仓库不能为空!");
|
|
|
+ }
|
|
|
+ int count2 = 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='" + whcode2 + "'");
|
|
|
+ if (count2<=0){
|
|
|
+ return ApiResponse.failRsp("10044",request.getHeader("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",
|
|
|
+ "cd_varchar50_1='" + whcode2 + "'");
|
|
|
+
|
|
|
Object lineId = object.get("lineId");
|
|
|
Object mmdetno = baseDao.getFieldDataByCondition("MakeMaterial", "mm_detno", "mm_id in (" + lineId+")");
|
|
|
if(bccode!=null) {
|
|
|
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) " +
|
|
|
"values (PRODIODETAIL_SEQ.nextval," + bcpiid + ",'" + bccode + "','"+bcpiclass+"'," + detno + ",'" + itemNo +
|
|
|
- "'," + qty + ",'" + mmwhcode + "','" + mmwhname + "','" + warehouses[0] + "','" + warehouses[1] + "')");
|
|
|
+ "'," + qty + ",'" + warehouses2[0] + "','" + warehouses2[1] + "','" + warehouses[0] + "','" + warehouses[1] + "')");
|
|
|
}
|
|
|
sqls.add("insert into prodiodetail (pd_id,pd_piid,pd_inoutno,pd_piclass,pd_pdno,pd_prodcode," +
|
|
|
"pd_outqty,pd_whcode,pd_whname,pd_ordercode,pd_orderdetno) " +
|
|
|
@@ -495,9 +524,12 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map4 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FSManagerID")));
|
|
|
Map<Object, Object> map5 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FBillerID")));
|
|
|
id = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
|
- code = baseDao.sGetMaxNumber("ProdInOut!Make!Return", 2);
|
|
|
- sqls.add("insert into prodinout (pi_id,pi_inoutno,pi_class,pi_date,pi_statuscode,pi_status,pi_departmentcode,pi_departmentname,pi_emcode,pi_emname,pi_invostatuscode,pi_invostatus,pi_recordman,pi_recorddate,pi_printstatuscode,pi_printstatus,pi_type) " +
|
|
|
- "values ("+id+",'"+code+"','生产退料单',to_date('"+jsonObject2.get("Fdate")+"','yyyy/MM/dd HH24:mi:ss'),'UNPOST','未过账','"+map1.get("FNumber")+"','"+map1.get("FName")+"','"+map4.get("FNumber")+"','"+map4.get("FName")+"','ENTERING','在录入','"+map5.get("FName")+"',to_date('"+jsonObject2.get("Fdate")+"','yyyy/MM/dd HH24:mi:ss'),'UNPRINT','未打印','"+map2.get("FName")+"')");
|
|
|
+ code = baseDao.sGetMaxNumber("ProdInOut!AppropriationOut", 2);
|
|
|
+ sqls.add("insert into prodinout (pi_id,pi_inoutno,pi_class,pi_date,pi_statuscode,pi_status," +
|
|
|
+ "pi_departmentcode,pi_departmentname,pi_emcode,pi_emname,pi_invostatuscode,pi_invostatus," +
|
|
|
+ "pi_recordman,pi_recorddate,pi_printstatuscode,pi_printstatus,pi_type,pi_inoutman) " +
|
|
|
+ "values ("+id+",'"+code+"','拨出单',to_date('"+jsonObject2.get("Fdate")+"','yyyy/MM/dd HH24:mi:ss')," +
|
|
|
+ "'UNPOST','未过账','"+map1.get("FNumber")+"','"+map1.get("FName")+"','"+map4.get("FNumber")+"','"+map4.get("FName")+"','ENTERING','在录入','"+map5.get("FName")+"',to_date('"+jsonObject2.get("Fdate")+"','yyyy/MM/dd HH24:mi:ss'),'UNPRINT','未打印','"+map3.get("FName")+"')");
|
|
|
}
|
|
|
JSONArray array = data.get("detail");
|
|
|
int detno=1;
|
|
|
@@ -519,19 +551,34 @@ public class MESServiceImpl implements MESService {
|
|
|
if ("".equals(whcode)){
|
|
|
return ApiResponse.failRsp("10053",request.getHeader("RequestId"),"仓库编号不能为空!");
|
|
|
}
|
|
|
- int count = baseDao.getCount("select count(1) from Warehouse where wh_mesc_user='" + whcode + "'");
|
|
|
+ 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("10054",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- Object[] warehouses = baseDao.getFieldsDataByCondition("Warehouse", "wh_code,wh_description", "wh_mesc_user='" + whcode + "'");
|
|
|
+ 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 + "'");
|
|
|
+ Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID2"), "{}"));
|
|
|
+ String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
+ String whname2 = StringUtil.nvl(map2.get("FName"), "");
|
|
|
+ if ("".equals(whcode2)){
|
|
|
+ return ApiResponse.failRsp("10055",request.getHeader("RequestId"),"物料退回仓库不能为空!");
|
|
|
+ }
|
|
|
+ int count2 = 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='" + whcode2 + "'");
|
|
|
+ if (count2<=0){
|
|
|
+ return ApiResponse.failRsp("10074",request.getHeader("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",
|
|
|
+ "cd_varchar50_1='" + whcode2 + "'");
|
|
|
+
|
|
|
String ficmoBillNo = StringUtil.nvl(object.get("FICMOBillNo"), "");
|
|
|
String fBatchNo = StringUtil.nvl(object.get("FBatchNo"), "");
|
|
|
Object lineId = object.get("lineId");
|
|
|
Object mmdetno = baseDao.getFieldDataByCondition("MakeMaterial", "mm_detno", "mm_id in (" + lineId+")");
|
|
|
sqls.add("insert into prodiodetail (pd_id,pd_piid,pd_inoutno,pd_piclass,pd_pdno,pd_prodcode," +
|
|
|
- "pd_inqty,pd_whcode,pd_whname,pd_remark,pd_batchcode,pd_ordercode,pd_orderdetno) " +
|
|
|
- "values (PRODIODETAIL_SEQ.nextval,"+id+",'"+code+"','生产退料单',"+detno+",'"+itemNo+
|
|
|
- "',"+qty+",'"+warehouses[0]+"','"+warehouses[1]+"','"+fnote+"','"+fBatchNo+"','"+ficmoBillNo+"',"+mmdetno+ ")");
|
|
|
+ "pd_outqty,pd_whcode,pd_whname,pd_inwhcode,pd_inwhname) " +
|
|
|
+ "values (PRODIODETAIL_SEQ.nextval,"+id+",'"+code+"','拨出单',"+detno+",'"+itemNo+"',"+qty+",'"+warehouses[0]+"','"+warehouses[1]+"','"+warehouses2[0]+"','"+warehouses2[1]+"')");
|
|
|
detno++;
|
|
|
}
|
|
|
baseDao.execute(sqls);
|
|
|
@@ -579,22 +626,29 @@ public class MESServiceImpl implements MESService {
|
|
|
if ("".equals(whcode)){
|
|
|
return ApiResponse.failRsp("10063",request.getHeader("RequestId"),"发货仓库不能为空!");
|
|
|
}
|
|
|
- int count = baseDao.getCount("select count(1) from Warehouse where wh_mesc_user='" + whcode + "'");
|
|
|
+ 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("10064",request.getHeader("RequestId"),"发货仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
+ return ApiResponse.failRsp("10064",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- Object[] warehouses = baseDao.getFieldsDataByCondition("Warehouse", "wh_code,wh_description", "wh_mesc_user='" + whcode + "'");
|
|
|
- Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.valueOf(object.get("FDCStockID1")));
|
|
|
+ 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 + "'");Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.valueOf(object.get("FDCStockID1")));
|
|
|
String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
String whname2 = StringUtil.nvl(map2.get("FName"), "");
|
|
|
if ("".equals(whcode2)){
|
|
|
return ApiResponse.failRsp("10065",request.getHeader("RequestId"),"收货仓库不能为空!");
|
|
|
}
|
|
|
- int count2 = baseDao.getCount("select count(1) from Warehouse where wh_mesc_user='" + whcode2 + "'");
|
|
|
+ int count2 = 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='" + whcode2 + "'");
|
|
|
if (count2<=0){
|
|
|
- return ApiResponse.failRsp("10066",request.getHeader("RequestId"),"收货仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
+ return ApiResponse.failRsp("10066",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- Object[] warehouses2 = baseDao.getFieldsDataByCondition("Warehouse", "wh_code,wh_description", "wh_mesc_user='" + whcode2 + "'");
|
|
|
+ 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",
|
|
|
+ "cd_varchar50_1='" + whcode2 + "'");
|
|
|
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) values (PRODIODETAIL_SEQ.nextval,"+id+",'"+code+"','拨出单',"+detno+",'"+itemNo+"',"+qty+",'"+warehouses[0]+"','"+warehouses[1]+"','"+warehouses2[0]+"','"+warehouses2[1]+"')");
|
|
|
detno++;
|