|
|
@@ -115,7 +115,7 @@ public class MESServiceImpl implements MESService {
|
|
|
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 + "'");
|
|
|
+ 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 ;
|
|
|
Employee employee = baseDao.getJdbcTemplate().queryForObject("select * from employee where em_name=?",
|
|
|
@@ -205,7 +205,7 @@ public class MESServiceImpl implements MESService {
|
|
|
if (count<=0){
|
|
|
return ApiResponse.failRsp("10074",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 + "'");
|
|
|
+ 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 + "'");
|
|
|
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','未打印')");
|
|
|
@@ -225,7 +225,7 @@ public class MESServiceImpl implements MESService {
|
|
|
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 + "'");
|
|
|
+ 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 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"), "");
|
|
|
@@ -314,6 +314,7 @@ public class MESServiceImpl implements MESService {
|
|
|
if ("".equals(lineId)){
|
|
|
return ApiResponse.failRsp("10022",request.getHeader("RequestId"),"工单明细ID不能为空!");
|
|
|
}
|
|
|
+ Object mmdetno = baseDao.getFieldDataByCondition("MakeMaterial", "mm_detno", "mm_id in (" + lineId+")");
|
|
|
String prodNo = StringUtil.nvl(object.get("prodNo"), "");
|
|
|
if ("".equals(prodNo)){
|
|
|
return ApiResponse.failRsp("10023",request.getHeader("RequestId"),"工单单号不能为空!");
|
|
|
@@ -347,7 +348,7 @@ public class MESServiceImpl implements MESService {
|
|
|
String remark = StringUtil.nvl(object.get("remark"), "");
|
|
|
sqls.add("insert into MakeScrapdetail (md_id,md_msid,md_detno,md_mmid,md_mmcode,md_mmdetno,md_prodcode," +
|
|
|
"md_qty,md_reason,md_department,md_departmentname,md_allscrapqty,md_remark) values " +
|
|
|
- "(MAKESCRAPDETAIL_SEQ.nextval,"+id+","+detno+","+lineId+",'"+prodNo+"',"+prodDetno+",'"+itemNo+
|
|
|
+ "(MAKESCRAPDETAIL_SEQ.nextval,"+id+","+detno+","+lineId+",'"+prodNo+"',"+mmdetno+",'"+itemNo+
|
|
|
"',"+qty+",'"+reason+"','"+fDeptID+"','"+fDept+"',"+allScrapQty+",'"+remark+"')");
|
|
|
detno++;
|
|
|
}
|
|
|
@@ -398,7 +399,7 @@ public class MESServiceImpl implements MESService {
|
|
|
if (count<=0){
|
|
|
return ApiResponse.failRsp("10035",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 + "'");
|
|
|
+ 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 + "'");
|
|
|
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+
|
|
|
@@ -489,7 +490,7 @@ public class MESServiceImpl implements MESService {
|
|
|
if (count<=0){
|
|
|
return ApiResponse.failRsp("10044",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- 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 + "'");
|
|
|
+ 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 fSourceInterId = StringUtil.nvl(object.get("FSourceInterId"), "");
|
|
|
String ficmoBillNo = StringUtil.nvl(object.get("FICMOBillNo"), "");
|
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID2"), "{}"));
|
|
|
@@ -506,7 +507,7 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
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 + "'");
|
|
|
+ "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
|
|
|
|
|
|
Object lineId = object.get("lineId");
|
|
|
Object mmdetno = baseDao.getFieldDataByCondition("MakeMaterial", "mm_detno", "mm_id in (" + lineId+")");
|
|
|
@@ -581,7 +582,7 @@ public class MESServiceImpl implements MESService {
|
|
|
if (count<=0){
|
|
|
return ApiResponse.failRsp("10054",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
}
|
|
|
- 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 + "'");
|
|
|
+ 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 + "'");
|
|
|
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"), "");
|
|
|
@@ -596,7 +597,7 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
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 + "'");
|
|
|
+ "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode2 + "'");
|
|
|
|
|
|
String ficmoBillNo = StringUtil.nvl(object.get("FICMOBillNo"), "");
|
|
|
String fBatchNo = StringUtil.nvl(object.get("FBatchNo"), "");
|
|
|
@@ -668,7 +669,7 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
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")));
|
|
|
+ "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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)){
|
|
|
@@ -682,7 +683,7 @@ public class MESServiceImpl implements MESService {
|
|
|
}
|
|
|
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 + "'");
|
|
|
+ "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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++;
|
|
|
@@ -699,12 +700,41 @@ public class MESServiceImpl implements MESService {
|
|
|
|
|
|
@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);
|
|
|
+ try {
|
|
|
+ String data = PSHttpUtils.readRaw(request.getInputStream());
|
|
|
+ JSONArray jsonArray = JSON.parseArray(data);
|
|
|
+ for (int i = 0; i <jsonArray.size() ; i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ String whcode = StringUtil.nvl(jsonObject.getString("outwhcode"), "");
|
|
|
+ if ("".equals(whcode)){
|
|
|
+ return ApiResponse.failRsp("10081",request.getHeader("RequestId"),"拨出仓库不能为空!");
|
|
|
+ }
|
|
|
+ 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("10082",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
+ }
|
|
|
+ Object outwhcode = baseDao.getFieldDataByCondition("customtabledetail left join customtable on cd_ctid=ct_id", "cd_varchar50_3", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode + "'");
|
|
|
+ jsonObject.put("outwhcode",outwhcode);
|
|
|
+ String whcode1 = StringUtil.nvl(jsonObject.getString("outwhcode"), "");
|
|
|
+ if ("".equals(whcode1)){
|
|
|
+ return ApiResponse.failRsp("10083",request.getHeader("RequestId"),"拨入仓库不能为空!");
|
|
|
+ }
|
|
|
+ int count1 = 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='" + whcode1 + "'");
|
|
|
+ if (count1<=0){
|
|
|
+ return ApiResponse.failRsp("10084",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
+ }
|
|
|
+ Object inwhcode = baseDao.getFieldDataByCondition("customtabledetail left join customtable on cd_ctid=ct_id", "cd_varchar50_3", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and cd_varchar50_1='" + whcode1 + "'");
|
|
|
+ jsonObject.put("inwhcode",inwhcode);
|
|
|
+ }
|
|
|
+ String msg = baseDao.callProcedure("USER_CHECKOUTSTOCK", new Object[]{"", jsonArray});
|
|
|
+ if (msg != null && !msg.trim().equals("")){
|
|
|
+ return ApiResponse.failRsp("10085",request.getHeader("RequestId"),msg);
|
|
|
+ }
|
|
|
+ return ApiResponse.successRsp("0",request.getHeader("RequestId"),"校验通过!");
|
|
|
+ } catch (IOException e) {
|
|
|
+ return ApiResponse.failRsp("10086",request.getHeader("RequestId"),e.getMessage());
|
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"校验通过!");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private Map<String, JSONArray> getData(HttpServletRequest request){
|