|
@@ -40,16 +40,17 @@ public class MESServiceImpl implements MESService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> checkVerifyApply(HttpServletRequest request) {
|
|
public ApiResult<String> checkVerifyApply(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
JSONObject jsonData = getJsonData(request);
|
|
JSONObject jsonData = getJsonData(request);
|
|
|
String mesCode = StringUtil.nvl(jsonData.get("mesCode"), "");
|
|
String mesCode = StringUtil.nvl(jsonData.get("mesCode"), "");
|
|
|
if ("".equals(mesCode)){
|
|
if ("".equals(mesCode)){
|
|
|
- return ApiResponse.failRsp("10011",request.getHeader("RequestId"),"MES编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10011",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,va_departmentcode,va_department,va_recorder,case when nvl(va_cop,' ')=' ' then 'BYT' else va_cop end 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,va_custcode,va_custname from VerifyApply 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,case when nvl(va_cop,' ')=' ' then 'BYT' else va_cop end 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,va_custcode,va_custname from VerifyApply where va_statuscode='AUDITED' and va_mescode=?",
|
|
|
new BeanPropertyRowMapper<VerifyApply>(VerifyApply.class), mesCode);
|
|
new BeanPropertyRowMapper<VerifyApply>(VerifyApply.class), mesCode);
|
|
|
|
|
|
|
|
if (verifyApply==null) {
|
|
if (verifyApply==null) {
|
|
|
- return ApiResponse.failRsp("10012",request.getHeader("RequestId"),"单据未审核或不存在,请确认!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10012",requestId,"单据未审核或不存在,请确认!");
|
|
|
}
|
|
}
|
|
|
SqlRowList rs = baseDao.queryForRowSet("select case when va_custcode='AR214' or nvl(va_custcode,' ')=' ' then 'BYT' else nvl(cu_mescode,cu_code) end cu_code,cu_name from verifyapply left join customer on va_custcode=cu_code where va_statuscode='AUDITED' and va_mescode='"+mesCode+"'");
|
|
SqlRowList rs = baseDao.queryForRowSet("select case when va_custcode='AR214' or nvl(va_custcode,' ')=' ' then 'BYT' else nvl(cu_mescode,cu_code) end cu_code,cu_name from verifyapply left join customer on va_custcode=cu_code where va_statuscode='AUDITED' and va_mescode='"+mesCode+"'");
|
|
|
if (rs.next()){
|
|
if (rs.next()){
|
|
@@ -58,11 +59,12 @@ public class MESServiceImpl implements MESService {
|
|
|
List<VerifyApplyDetail> verifyApplyDetails = baseDao.query("select vad_code,vad_prodcode,pr_detail,replace(PR_SPEC,'''','''''') pr_spec,pr_unit,va_recorder,va_date,pr_kh_user,cu_name,sum(nvl(vad_qty,0)) vad_qty,vad_salecode 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,vad_salecode 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 nvl(vad_qty,0)>0 and 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,vad_salecode", VerifyApplyDetail.class);
|
|
List<VerifyApplyDetail> verifyApplyDetails = baseDao.query("select vad_code,vad_prodcode,pr_detail,replace(PR_SPEC,'''','''''') pr_spec,pr_unit,va_recorder,va_date,pr_kh_user,cu_name,sum(nvl(vad_qty,0)) vad_qty,vad_salecode 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,vad_salecode 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 nvl(vad_qty,0)>0 and 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,vad_salecode", VerifyApplyDetail.class);
|
|
|
verifyApply.setDetail(verifyApplyDetails);
|
|
verifyApply.setDetail(verifyApplyDetails);
|
|
|
String s = JSON.toJSONString(verifyApply, SerializerFeature.WriteMapNullValue);
|
|
String s = JSON.toJSONString(verifyApply, SerializerFeature.WriteMapNullValue);
|
|
|
- return ApiResponse.successRsp("0","获取成功!",request.getHeader("RequestId"),s);
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0","获取成功!",requestId,s);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> purcCheckin(HttpServletRequest request) {
|
|
public ApiResult<String> purcCheckin(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
Map<String, JSONArray> data = getData(request);
|
|
Map<String, JSONArray> data = getData(request);
|
|
|
JSONArray jsonArray = data.get("main");
|
|
JSONArray jsonArray = data.get("main");
|
|
|
Object vaid=0;
|
|
Object vaid=0;
|
|
@@ -76,11 +78,11 @@ public class MESServiceImpl implements MESService {
|
|
|
String mesCode = StringUtil.nvl(jsonObject.get("mesCode"),"");
|
|
String mesCode = StringUtil.nvl(jsonObject.get("mesCode"),"");
|
|
|
whcode= StringUtil.nvl(jsonObject.get("whNo"), "");
|
|
whcode= StringUtil.nvl(jsonObject.get("whNo"), "");
|
|
|
if ("".equals(mesCode)){
|
|
if ("".equals(mesCode)){
|
|
|
- return ApiResponse.failRsp("10011",request.getHeader("RequestId"),"ERP单据编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10011",requestId,"ERP单据编号不能为空!");
|
|
|
}
|
|
}
|
|
|
int count = baseDao.getCountByCondition("verifyApply", "va_statuscode='AUDITED' and va_mescode='" + mesCode + "'");
|
|
int count = baseDao.getCountByCondition("verifyApply", "va_statuscode='AUDITED' and va_mescode='" + mesCode + "'");
|
|
|
if (count<1){
|
|
if (count<1){
|
|
|
- return ApiResponse.failRsp("10012",request.getHeader("RequestId"),"单据未审核或不存在,请确认!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10012",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_mescode='" + mesCode + "'");
|
|
|
String vaClass = StringUtil.nvl(baseDao.getFieldDataByCondition("VerifyApply", "va_class", "va_id=" + vaid), "");
|
|
String vaClass = StringUtil.nvl(baseDao.getFieldDataByCondition("VerifyApply", "va_class", "va_id=" + vaid), "");
|
|
@@ -99,14 +101,14 @@ public class MESServiceImpl implements MESService {
|
|
|
//判断已转数
|
|
//判断已转数
|
|
|
Object chekQty = baseDao.getJdbcTemplate().queryForObject("select wmsys.wm_concat('收料单:'||vad_code||'序号:'||vad_detno) from VerifyApplyDetail where vad_qty < vad_yqty and nvl(vad_qty,0)>0 and nvl(vad_prodcode,' ')<>' ' and vad_vaid = "+vaid, String.class);
|
|
Object chekQty = baseDao.getJdbcTemplate().queryForObject("select wmsys.wm_concat('收料单:'||vad_code||'序号:'||vad_detno) from VerifyApplyDetail where vad_qty < vad_yqty and nvl(vad_qty,0)>0 and nvl(vad_prodcode,' ')<>' ' and vad_vaid = "+vaid, String.class);
|
|
|
if(chekQty !=null){
|
|
if(chekQty !=null){
|
|
|
- return ApiResponse.failRsp("10013",request.getHeader("RequestId"),"检测到" + chekQty + ",本次数量超出可转数量!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10013",requestId,"检测到" + chekQty + ",本次数量超出可转数量!");
|
|
|
}
|
|
}
|
|
|
if ("VerifyApply!ToPurcIn".equals(caller)) {
|
|
if ("VerifyApply!ToPurcIn".equals(caller)) {
|
|
|
// 判断该收料单是否已经转入过采购验收单
|
|
// 判断该收料单是否已经转入过采购验收单
|
|
|
Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
|
|
Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
|
|
|
code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and " + "PI_REFNO='采购收料单' and pi_class='采购验收单'");
|
|
code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and " + "PI_REFNO='采购收料单' and pi_class='采购验收单'");
|
|
|
if (code != null && !code.equals("")) {
|
|
if (code != null && !code.equals("")) {
|
|
|
- return ApiResponse.failRsp("10014", request.getHeader("RequestId"), "该收料单已转入过采购验收单,验收单号[" + code + "]");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10014", requestId, "该收料单已转入过采购验收单,验收单号[" + code + "]");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if ("VerifyApply!ToOtherIn".equals(caller)) {
|
|
if ("VerifyApply!ToOtherIn".equals(caller)) {
|
|
@@ -114,7 +116,7 @@ public class MESServiceImpl implements MESService {
|
|
|
Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
|
|
Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
|
|
|
code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and PI_REFNO='采购收料单' and pi_class='其它入库单'");
|
|
code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and PI_REFNO='采购收料单' and pi_class='其它入库单'");
|
|
|
if (code != null && !code.equals("")) {
|
|
if (code != null && !code.equals("")) {
|
|
|
- return ApiResponse.failRsp("10014", request.getHeader("RequestId"), "该收料单已转入过其它入库单,单号[" + code + "]");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10014", requestId, "该收料单已转入过其它入库单,单号[" + code + "]");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if ("VerifyApply!ToOutsideCheckIn".equals(caller)) {
|
|
if ("VerifyApply!ToOutsideCheckIn".equals(caller)) {
|
|
@@ -122,7 +124,7 @@ public class MESServiceImpl implements MESService {
|
|
|
Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
|
|
Object code = baseDao.getFieldDataByCondition("VerifyApply", "va_code", "va_id=" + vaid);
|
|
|
code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and PI_REFNO='采购收料单' and pi_class='委外验收单'");
|
|
code = baseDao.getFieldDataByCondition("ProdInOut", "pi_inoutno", "pi_sourcecode='" + code + "' and PI_REFNO='采购收料单' and pi_class='委外验收单'");
|
|
|
if (code != null && !code.equals("")) {
|
|
if (code != null && !code.equals("")) {
|
|
|
- return ApiResponse.failRsp("10014", request.getHeader("RequestId"), "该收料单已转入过委外验收单,单号[" + code + "]");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10014", requestId, "该收料单已转入过委外验收单,单号[" + code + "]");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
sellerName = StringUtil.nvl(jsonObject.get("sellerName"), "mes");
|
|
sellerName = StringUtil.nvl(jsonObject.get("sellerName"), "mes");
|
|
@@ -135,18 +137,18 @@ public class MESServiceImpl implements MESService {
|
|
|
Double vadQty = baseDao.getSummaryByField("verifyapplydetail", "vad_qty", "vad_prodcode='" + itemNo + "' and vad_vaid=" + vaid);
|
|
Double vadQty = baseDao.getSummaryByField("verifyapplydetail", "vad_qty", "vad_prodcode='" + itemNo + "' and vad_vaid=" + vaid);
|
|
|
int compare = qty.compareTo(vadQty);
|
|
int compare = qty.compareTo(vadQty);
|
|
|
if (compare>0){
|
|
if (compare>0){
|
|
|
- return ApiResponse.failRsp("10017",request.getHeader("RequestId"), "物料:"+itemNo+",收料数量:"+qty+"超出ERP收料单数量:"+vadQty+ ",不允许入库!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10017",requestId, "物料:"+itemNo+",收料数量:"+qty+"超出ERP收料单数量:"+vadQty+ ",不允许入库!");
|
|
|
}
|
|
}
|
|
|
if (compare<0){
|
|
if (compare<0){
|
|
|
- return ApiResponse.failRsp("10018",request.getHeader("RequestId"),"物料:"+itemNo+",收料数量:"+qty+"少于ERP收料单数量:"+vadQty+",不允许入库!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10018",requestId,"物料:"+itemNo+",收料数量:"+qty+"少于ERP收料单数量:"+vadQty+",不允许入库!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if ("".equals(whcode)){
|
|
if ("".equals(whcode)){
|
|
|
- return ApiResponse.failRsp("10015",request.getHeader("RequestId"),"MES仓库编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10015",requestId,"MES仓库编号不能为空!");
|
|
|
}
|
|
}
|
|
|
int coun = 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 + "'");
|
|
int coun = 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 (coun<=0){
|
|
if (coun<=0){
|
|
|
- return ApiResponse.failRsp("10016",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10016",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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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 + "'");
|
|
|
|
|
|
|
@@ -209,15 +211,16 @@ public class MESServiceImpl implements MESService {
|
|
|
String s = postProdInOut(piid, djcaller, employee);
|
|
String s = postProdInOut(piid, djcaller, employee);
|
|
|
logger.info("收料单入库=="+s);
|
|
logger.info("收料单入库=="+s);
|
|
|
if (s!=null){
|
|
if (s!=null){
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),type+":"+key.getCode()+",过账失败,请在ERP重新过账!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,type+":"+key.getCode()+",过账失败,请在ERP重新过账!");
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),type+":"+key.getCode()+",请在ERP查看!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,type+":"+key.getCode()+",请在ERP查看!");
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.failRsp("10019",request.getHeader("RequestId"),"ERP生成单据失败!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10019",requestId,"ERP生成单据失败!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> prodInOutMakeIn(HttpServletRequest request) {
|
|
public ApiResult<String> prodInOutMakeIn(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
Map<String, JSONArray> data = getData(request);
|
|
Map<String, JSONArray> data = getData(request);
|
|
|
JSONArray jsonArray = data.get("main");
|
|
JSONArray jsonArray = data.get("main");
|
|
|
String ma_tasktype="";
|
|
String ma_tasktype="";
|
|
@@ -239,12 +242,12 @@ public class MESServiceImpl implements MESService {
|
|
|
ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
|
ma_id = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
ma_id = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
|
} else {
|
|
} else {
|
|
|
- return ApiResponse.failRsp("10077", request.getHeader("RequestId"), "工单在ERP不存在,请核对!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10077", requestId, "工单在ERP不存在,请核对!");
|
|
|
}
|
|
}
|
|
|
float fauxqty = json.get("Fauxqty") == null ? 0 : Float.parseFloat(json.get("Fauxqty").toString());
|
|
float fauxqty = json.get("Fauxqty") == null ? 0 : Float.parseFloat(json.get("Fauxqty").toString());
|
|
|
String msg = baseDao.callProcedure("USER_WGRKCHECK", new Object[]{ma_id, fauxqty});
|
|
String msg = baseDao.callProcedure("USER_WGRKCHECK", new Object[]{ma_id, fauxqty});
|
|
|
if (msg != null && !msg.trim().equals("")){
|
|
if (msg != null && !msg.trim().equals("")){
|
|
|
- return ApiResponse.failRsp("10078",request.getHeader("RequestId"),msg);
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10078",requestId,msg);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -256,14 +259,9 @@ public class MESServiceImpl implements MESService {
|
|
|
Object obj = jsonArray.get(i);
|
|
Object obj = jsonArray.get(i);
|
|
|
JSONObject jsonObject2 = JSON.parseObject(StringUtil.nvl(obj, ""));
|
|
JSONObject jsonObject2 = JSON.parseObject(StringUtil.nvl(obj, ""));
|
|
|
String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
|
- if ("".equals(fSelBillNo)){
|
|
|
|
|
- return ApiResponse.failRsp("10079", request.getHeader("RequestId"), "MES单号不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
- int count1 = baseDao.getCount("select count(1) from prodinout where pi_class='" + piclass + "' and " +
|
|
|
|
|
- "pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- if (count1>0){
|
|
|
|
|
- Object co = baseDao.getFieldDataByCondition("prodinout", "pi_inoutno", "pi_class='" + piclass + "' and pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"MES单号:"+fSelBillNo+"已存在,请在ERP查看"+piclass+",单据编号:"+co);
|
|
|
|
|
|
|
+ ApiResult<String> result = checkMESCode(requestId, fSelBillNo, piclass);
|
|
|
|
|
+ if (result!=null){
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
Map<Object, Object> map4 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FDCStockID")));
|
|
Map<Object, Object> map4 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FDCStockID")));
|
|
|
Map<Object, Object> map5 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FDeptID")));
|
|
Map<Object, Object> map5 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FDeptID")));
|
|
@@ -272,11 +270,11 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map8 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FBillerID")));
|
|
Map<Object, Object> map8 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FBillerID")));
|
|
|
String whcode = StringUtil.nvl(map4.get("FNumber"), "");
|
|
String whcode = StringUtil.nvl(map4.get("FNumber"), "");
|
|
|
if ("".equals(whcode)) {
|
|
if ("".equals(whcode)) {
|
|
|
- return ApiResponse.failRsp("10073", request.getHeader("RequestId"), "MES仓库编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10073", requestId, "MES仓库编号不能为空!");
|
|
|
}
|
|
}
|
|
|
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 + "'");
|
|
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) {
|
|
if (count <= 0) {
|
|
|
- return ApiResponse.failRsp("10074", request.getHeader("RequestId"), "MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10074", 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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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 + "'");
|
|
|
if ("OS".equals(ma_tasktype)) {
|
|
if ("OS".equals(ma_tasktype)) {
|
|
@@ -307,11 +305,11 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map12 = JSONUtil.toMap(StringUtil.valueOf(jsonObject3.get("FDCStockID1")));
|
|
Map<Object, Object> map12 = JSONUtil.toMap(StringUtil.valueOf(jsonObject3.get("FDCStockID1")));
|
|
|
String whcode = StringUtil.nvl(map12.get("FNumber"), "");
|
|
String whcode = StringUtil.nvl(map12.get("FNumber"), "");
|
|
|
if ("".equals(whcode)){
|
|
if ("".equals(whcode)){
|
|
|
- return ApiResponse.failRsp("10075",request.getHeader("RequestId"),"MES仓库编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10075",requestId,"MES仓库编号不能为空!");
|
|
|
}
|
|
}
|
|
|
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 + "'");
|
|
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){
|
|
if (count<=0){
|
|
|
- return ApiResponse.failRsp("10076",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10076",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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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"), "");
|
|
String fBatchNo = StringUtil.nvl(jsonObject3.get("FBatchNo"), "");
|
|
@@ -381,13 +379,14 @@ public class MESServiceImpl implements MESService {
|
|
|
String s = postProdInOut(piid, picaller, employee);
|
|
String s = postProdInOut(piid, picaller, employee);
|
|
|
logger.info("完工过账信息=="+s);
|
|
logger.info("完工过账信息=="+s);
|
|
|
if (s!=null){
|
|
if (s!=null){
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),piclass+":"+picode+",过账失败,请在ERP重新过账!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,piclass+":"+picode+",过账失败,请在ERP重新过账!");
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),piclass+":"+picode+",请在ERP查看!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,piclass+":"+picode+",请在ERP查看!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> makeDeleteCheck(HttpServletRequest request) {
|
|
public ApiResult<String> makeDeleteCheck(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
JSONObject jsonData = getJsonData(request);
|
|
JSONObject jsonData = getJsonData(request);
|
|
|
Object maId = jsonData.get("finterid");
|
|
Object maId = jsonData.get("finterid");
|
|
|
// 只能删除在录入的单据!
|
|
// 只能删除在录入的单据!
|
|
@@ -395,43 +394,52 @@ public class MESServiceImpl implements MESService {
|
|
|
baseDao.queryForRowSet("select ma_statuscode,ma_checkstatuscode from make where ma_code='"+maId+"'");
|
|
baseDao.queryForRowSet("select ma_statuscode,ma_checkstatuscode from make where ma_code='"+maId+"'");
|
|
|
if (status.next()) {
|
|
if (status.next()) {
|
|
|
if (!status.getString("ma_statuscode").equals("ENTERING") && (status.getString("ma_checkstatuscode").equals("APPROVE") || status.getString("ma_checkstatuscode").equals("COMMITED"))) {
|
|
if (!status.getString("ma_statuscode").equals("ENTERING") && (status.getString("ma_checkstatuscode").equals("APPROVE") || status.getString("ma_checkstatuscode").equals("COMMITED"))) {
|
|
|
- return ApiResponse.failRsp("10015",request.getHeader("RequestId"),"只能删除在录入且批准状态不等于已批准或已提交的工单");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10015",requestId,"只能删除在录入且批准状态不等于已批准或已提交的工单");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 启用工厂模式 有对应的作业单 制造单不能删除
|
|
// 启用工厂模式 有对应的作业单 制造单不能删除
|
|
|
if (baseDao.isDBSetting("sys","usingMakeCraft")) {
|
|
if (baseDao.isDBSetting("sys","usingMakeCraft")) {
|
|
|
int count = baseDao.getCount("Select count(1) from makecraft left join make on mc_makecode=ma_code where ma_code='"+maId+"'");
|
|
int count = baseDao.getCount("Select count(1) from makecraft left join make on mc_makecode=ma_code where ma_code='"+maId+"'");
|
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
|
- return ApiResponse.failRsp("10016",request.getHeader("RequestId"),"当前工单存在作业单,不能删除");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10016",requestId,"当前工单存在作业单,不能删除");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"校验通过!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"校验通过!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> initMakeScrap(HttpServletRequest request) {
|
|
public ApiResult<String> initMakeScrap(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
Map<String, JSONArray> data = getData(request);
|
|
Map<String, JSONArray> data = getData(request);
|
|
|
JSONArray jsonArray = data.get("main");
|
|
JSONArray jsonArray = data.get("main");
|
|
|
int id=0;
|
|
int id=0;
|
|
|
String code="";
|
|
String code="";
|
|
|
|
|
+ String msclass="生产报废单";
|
|
|
|
|
+ String caller="MakeScrap";
|
|
|
List<String> sqls = new ArrayList<>();
|
|
List<String> sqls = new ArrayList<>();
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
|
JSONObject jsonObject = JSON.parseObject(StringUtil.nvl(jsonArray.get(i), ""));
|
|
JSONObject jsonObject = JSON.parseObject(StringUtil.nvl(jsonArray.get(i), ""));
|
|
|
|
|
+ String fSelBillNo = StringUtil.nvl(jsonObject.get("FSelBillNo"), "");
|
|
|
|
|
+ if ("".equals(fSelBillNo)){
|
|
|
|
|
+ return ApiResponse.failRsp("10029", requestId, "MES单号不能为空!");
|
|
|
|
|
+ }
|
|
|
|
|
+ int count = baseDao.getCount("select count(1) from MakeScrap where ms_class='" + msclass + "' and ms_mescode='" + fSelBillNo + "'");
|
|
|
|
|
+ if (count>0){
|
|
|
|
|
+ Object co = baseDao.getFieldDataByCondition("MakeScrap", "ms_code", "ms_class='" + msclass + "' and ms_mescode='" + fSelBillNo + "'");
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"MES单号:"+fSelBillNo+"已存在,请在ERP查看"+msclass+",单据编号:"+co);
|
|
|
|
|
+ }
|
|
|
id = baseDao.getSeqId("MAKESCRAP_SEQ");
|
|
id = baseDao.getSeqId("MAKESCRAP_SEQ");
|
|
|
- code = baseDao.sGetMaxNumber("MakeScrap", 2);
|
|
|
|
|
|
|
+ code = baseDao.sGetMaxNumber(caller, 2);
|
|
|
String fdateTime = StringUtil.nvl(jsonObject.get("FdateTime"), DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
String fdateTime = StringUtil.nvl(jsonObject.get("FdateTime"), DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
String fwcCode = StringUtil.nvl(jsonObject.get("FwcCode"), "");
|
|
String fwcCode = StringUtil.nvl(jsonObject.get("FwcCode"), "");
|
|
|
if ("".equals(fwcCode)) {
|
|
if ("".equals(fwcCode)) {
|
|
|
- return ApiResponse.failRsp("10021", request.getHeader("RequestId"), "工作中心不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10021", requestId, "工作中心不能为空!");
|
|
|
}
|
|
}
|
|
|
String createdUser = StringUtil.nvl(jsonObject.get("createdUser"), "mes");
|
|
String createdUser = StringUtil.nvl(jsonObject.get("createdUser"), "mes");
|
|
|
String createdDateTime = StringUtil.nvl(jsonObject.get("createdDateTime"), DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
String createdDateTime = StringUtil.nvl(jsonObject.get("createdDateTime"), DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
|
|
String companyNo = StringUtil.nvl(jsonObject.get("companyNo"), "BYT");
|
|
String companyNo = StringUtil.nvl(jsonObject.get("companyNo"), "BYT");
|
|
|
String fremark = StringUtil.nvl(jsonObject.get("Fremark"), "");
|
|
String fremark = StringUtil.nvl(jsonObject.get("Fremark"), "");
|
|
|
- sqls.add("insert into MakeScrap (ms_id,ms_code,ms_class,ms_statuscode,ms_status,ms_printstatuscode,ms_printstatus," +
|
|
|
|
|
- "ms_date,ms_wccode,ms_recordman,ms_indate,ms_cop,ms_remark) values (" + id + ",'" + code + "','生产报废单','ENTERING'," +
|
|
|
|
|
- "'在录入','UNPRINT','未打印',to_date('" + fdateTime + "','yyyy-MM-dd HH24:mi:ss'),'" + fwcCode + "','" + createdUser +
|
|
|
|
|
- "',to_date('" + createdDateTime + "','yyyy-MM-dd HH24:mi:ss'),'" + companyNo + "','" + fremark + "')");
|
|
|
|
|
|
|
+ sqls.add("insert into MakeScrap (ms_id,ms_code,ms_class,ms_statuscode,ms_status,ms_printstatuscode,ms_printstatus,ms_date,ms_wccode,ms_recordman,ms_indate,ms_cop,ms_remark,ms_mescode) values (" + id + ",'" + code + "','"+msclass+ "','ENTERING','在录入','UNPRINT','未打印',to_date('" + fdateTime + "','yyyy-MM-dd HH24:mi:ss'),'" + fwcCode + "','" + createdUser + "',to_date('" + createdDateTime + "','yyyy-MM-dd HH24:mi:ss'),'" + companyNo + "','" + fremark + "','"+fSelBillNo+"')");
|
|
|
}
|
|
}
|
|
|
JSONArray array = data.get("detail");
|
|
JSONArray array = data.get("detail");
|
|
|
int detno=1;
|
|
int detno=1;
|
|
@@ -439,36 +447,36 @@ public class MESServiceImpl implements MESService {
|
|
|
JSONObject object = JSON.parseObject(StringUtil.nvl(array.get(i), "{}"));
|
|
JSONObject object = JSON.parseObject(StringUtil.nvl(array.get(i), "{}"));
|
|
|
String lineId = StringUtil.nvl(object.get("lineId"), "");
|
|
String lineId = StringUtil.nvl(object.get("lineId"), "");
|
|
|
if ("".equals(lineId)){
|
|
if ("".equals(lineId)){
|
|
|
- return ApiResponse.failRsp("10022",request.getHeader("RequestId"),"工单明细ID不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10022",requestId,"工单明细ID不能为空!");
|
|
|
}
|
|
}
|
|
|
Object mmdetno = baseDao.getFieldDataByCondition("MakeMaterial", "mm_detno", "mm_id in (" + lineId+")");
|
|
Object mmdetno = baseDao.getFieldDataByCondition("MakeMaterial", "mm_detno", "mm_id in (" + lineId+")");
|
|
|
String prodNo = StringUtil.nvl(object.get("prodNo"), "");
|
|
String prodNo = StringUtil.nvl(object.get("prodNo"), "");
|
|
|
if ("".equals(prodNo)){
|
|
if ("".equals(prodNo)){
|
|
|
- return ApiResponse.failRsp("10023",request.getHeader("RequestId"),"工单单号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10023",requestId,"工单单号不能为空!");
|
|
|
}
|
|
}
|
|
|
String prodDetno = StringUtil.nvl(object.get("prodDetno"), "");
|
|
String prodDetno = StringUtil.nvl(object.get("prodDetno"), "");
|
|
|
if ("".equals(prodDetno)){
|
|
if ("".equals(prodDetno)){
|
|
|
- return ApiResponse.failRsp("10024",request.getHeader("RequestId"),"工单行号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10024",requestId,"工单行号不能为空!");
|
|
|
}
|
|
}
|
|
|
String itemNo = StringUtil.nvl(object.get("itemNo"), "");
|
|
String itemNo = StringUtil.nvl(object.get("itemNo"), "");
|
|
|
if ("".equals(itemNo)){
|
|
if ("".equals(itemNo)){
|
|
|
- return ApiResponse.failRsp("10024",request.getHeader("RequestId"),"物料不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10024",requestId,"物料不能为空!");
|
|
|
}
|
|
}
|
|
|
String qty = StringUtil.nvl(object.get("qty"), "");
|
|
String qty = StringUtil.nvl(object.get("qty"), "");
|
|
|
if ("".equals(qty)){
|
|
if ("".equals(qty)){
|
|
|
- return ApiResponse.failRsp("10025",request.getHeader("RequestId"),"报废数量不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10025",requestId,"报废数量不能为空!");
|
|
|
}
|
|
}
|
|
|
String reason = StringUtil.nvl(object.get("reason"), "");
|
|
String reason = StringUtil.nvl(object.get("reason"), "");
|
|
|
if ("".equals(reason)){
|
|
if ("".equals(reason)){
|
|
|
- return ApiResponse.failRsp("10026",request.getHeader("RequestId"),"报废原因不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10026",requestId,"报废原因不能为空!");
|
|
|
}
|
|
}
|
|
|
String fDeptID = StringUtil.nvl(object.get("FDeptID"), "");
|
|
String fDeptID = StringUtil.nvl(object.get("FDeptID"), "");
|
|
|
if ("".equals(fDeptID)){
|
|
if ("".equals(fDeptID)){
|
|
|
- return ApiResponse.failRsp("10027",request.getHeader("RequestId"),"责任部门编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10027",requestId,"责任部门编号不能为空!");
|
|
|
}
|
|
}
|
|
|
String fDept = StringUtil.nvl(object.get("FDept"), "");
|
|
String fDept = StringUtil.nvl(object.get("FDept"), "");
|
|
|
if ("".equals(fDept)){
|
|
if ("".equals(fDept)){
|
|
|
- return ApiResponse.failRsp("10028",request.getHeader("RequestId"),"责任部门不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10028",requestId,"责任部门不能为空!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String allScrapQty = StringUtil.nvl(object.get("AllScrapQty"), "0");
|
|
String allScrapQty = StringUtil.nvl(object.get("AllScrapQty"), "0");
|
|
@@ -478,11 +486,12 @@ public class MESServiceImpl implements MESService {
|
|
|
detno++;
|
|
detno++;
|
|
|
}
|
|
}
|
|
|
baseDao.execute(sqls);
|
|
baseDao.execute(sqls);
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"生产报废单:"+code+",请在ERP查看!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"生产报废单:"+code+",请在ERP查看!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> prodInOutOtherOut(HttpServletRequest request) {
|
|
public ApiResult<String> prodInOutOtherOut(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
Map<String, JSONArray> data = getData(request);
|
|
Map<String, JSONArray> data = getData(request);
|
|
|
JSONArray jsonArray = data.get("main");
|
|
JSONArray jsonArray = data.get("main");
|
|
|
int id=0;
|
|
int id=0;
|
|
@@ -493,13 +502,9 @@ public class MESServiceImpl implements MESService {
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
|
JSONObject jsonObject2 = JSON.parseObject(StringUtil.nvl(jsonArray.get(i), ""));
|
|
JSONObject jsonObject2 = JSON.parseObject(StringUtil.nvl(jsonArray.get(i), ""));
|
|
|
String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
|
- if ("".equals(fSelBillNo)){
|
|
|
|
|
- return ApiResponse.failRsp("10039", request.getHeader("RequestId"), "MES单号不能为空!");
|
|
|
|
|
- }
|
|
|
|
|
- int count = baseDao.getCount("select count(1) from prodinout where pi_class='" + piclass + "' and pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- if (count>0){
|
|
|
|
|
- Object co = baseDao.getFieldDataByCondition("prodinout", "pi_inoutno", "pi_class='" + piclass + "' and pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"MES单号:"+fSelBillNo+"已存在,请在ERP查看"+piclass+",单据编号:"+co);
|
|
|
|
|
|
|
+ ApiResult<String> result = checkMESCode(requestId, fSelBillNo, piclass);
|
|
|
|
|
+ if (result!=null){
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FDeptID")));
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FDeptID")));
|
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FBillTypeID")));
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FBillTypeID")));
|
|
@@ -525,22 +530,22 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
|
if ("".equals(itemNo)){
|
|
if ("".equals(itemNo)){
|
|
|
- return ApiResponse.failRsp("10031",request.getHeader("RequestId"),"物料不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10031",requestId,"物料不能为空!");
|
|
|
}
|
|
}
|
|
|
String qty = StringUtil.nvl(object.get("FAuxQtyMust"), "");
|
|
String qty = StringUtil.nvl(object.get("FAuxQtyMust"), "");
|
|
|
if ("".equals(qty)){
|
|
if ("".equals(qty)){
|
|
|
- return ApiResponse.failRsp("10032",request.getHeader("RequestId"),"实出数量不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10032",requestId,"实出数量不能为空!");
|
|
|
}
|
|
}
|
|
|
String fnote = StringUtil.nvl(object.get("Fnote"), "");
|
|
String fnote = StringUtil.nvl(object.get("Fnote"), "");
|
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FDCStockID1")));
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FDCStockID1")));
|
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
|
String whname = StringUtil.nvl(map1.get("FName"), "");
|
|
String whname = StringUtil.nvl(map1.get("FName"), "");
|
|
|
if ("".equals(whcode)){
|
|
if ("".equals(whcode)){
|
|
|
- return ApiResponse.failRsp("10034",request.getHeader("RequestId"),"MES仓库编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10034",requestId,"MES仓库编号不能为空!");
|
|
|
}
|
|
}
|
|
|
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 + "'");
|
|
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){
|
|
if (count<=0){
|
|
|
- return ApiResponse.failRsp("10035",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10035",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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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) " +
|
|
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) " +
|
|
@@ -553,13 +558,14 @@ public class MESServiceImpl implements MESService {
|
|
|
String s = postProdInOut(id, caller, employee);
|
|
String s = postProdInOut(id, caller, employee);
|
|
|
logger.info("其它出库单过账信息=="+s);
|
|
logger.info("其它出库单过账信息=="+s);
|
|
|
if (s!=null){
|
|
if (s!=null){
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"其它出库单:"+code+",过账失败,请在ERP重新过账!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"其它出库单:"+code+",过账失败,请在ERP重新过账!");
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"其它出库单:"+code+",请在ERP查看!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"其它出库单:"+code+",请在ERP查看!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> prodInOutPicking(HttpServletRequest request) {
|
|
public ApiResult<String> prodInOutPicking(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
Map<String, JSONArray> data = getData(request);
|
|
Map<String, JSONArray> data = getData(request);
|
|
|
JSONArray jsonArray = data.get("main");
|
|
JSONArray jsonArray = data.get("main");
|
|
|
String bccode = null;
|
|
String bccode = null;
|
|
@@ -580,7 +586,7 @@ public class MESServiceImpl implements MESService {
|
|
|
ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
|
maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
|
}else {
|
|
}else {
|
|
|
- return ApiResponse.failRsp("10046", request.getHeader("RequestId"), "工单在ERP不存在,请核对!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10046", requestId, "工单在ERP不存在,请核对!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
@@ -595,18 +601,13 @@ public class MESServiceImpl implements MESService {
|
|
|
llcaller = "ProdInOut!OutsidePicking";
|
|
llcaller = "ProdInOut!OutsidePicking";
|
|
|
}
|
|
}
|
|
|
String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
|
- if ("".equals(fSelBillNo)){
|
|
|
|
|
- return ApiResponse.failRsp("10049", request.getHeader("RequestId"), "MES单号不能为空!");
|
|
|
|
|
|
|
+ ApiResult<String> result = checkMESCode(requestId, fSelBillNo, llpiclass);
|
|
|
|
|
+ if (result!=null){
|
|
|
|
|
+ return result;
|
|
|
}
|
|
}
|
|
|
- int count = baseDao.getCount("select count(1) from prodinout where pi_class='" + llpiclass + "' and pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- if (count>0){
|
|
|
|
|
- Object co = baseDao.getFieldDataByCondition("prodinout", "pi_inoutno", "pi_class='" + llpiclass + "' and pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"MES单号:"+fSelBillNo+"已存在,请在ERP查看"+llpiclass+",单据编号:"+co);
|
|
|
|
|
- }
|
|
|
|
|
- int count1 = baseDao.getCount("select count(1) from prodinout where pi_class='" + bcpiclass + "' and pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- if (count1>0){
|
|
|
|
|
- Object co = baseDao.getFieldDataByCondition("prodinout", "pi_inoutno", "pi_class='" + bcpiclass + "' and pi_mescode='" + fSelBillNo + "'");
|
|
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"MES单号:"+fSelBillNo+"已存在,请在ERP查看"+bcpiclass+",单据编号:"+co);
|
|
|
|
|
|
|
+ ApiResult<String> result1 = checkMESCode(requestId, fSelBillNo, bcpiclass);
|
|
|
|
|
+ if (result1!=null){
|
|
|
|
|
+ return result1;
|
|
|
}
|
|
}
|
|
|
if(!notCreateAppropriation){
|
|
if(!notCreateAppropriation){
|
|
|
//生成拨出单
|
|
//生成拨出单
|
|
@@ -632,21 +633,21 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
|
if ("".equals(itemNo)){
|
|
if ("".equals(itemNo)){
|
|
|
- return ApiResponse.failRsp("10041",request.getHeader("RequestId"),"物料不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10041",requestId,"物料不能为空!");
|
|
|
}
|
|
}
|
|
|
String fAuxQty = StringUtil.nvl(object.get("FAuxQty"), "0");
|
|
String fAuxQty = StringUtil.nvl(object.get("FAuxQty"), "0");
|
|
|
if ("0".equals(fAuxQty)){
|
|
if ("0".equals(fAuxQty)){
|
|
|
- return ApiResponse.failRsp("10042",request.getHeader("RequestId"),"实发数量不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10042",requestId,"实发数量不能为空!");
|
|
|
}
|
|
}
|
|
|
Double qty = Double.parseDouble(fAuxQty);
|
|
Double qty = Double.parseDouble(fAuxQty);
|
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FSCStockID1")));
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FSCStockID1")));
|
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
|
if ("".equals(whcode)){
|
|
if ("".equals(whcode)){
|
|
|
- return ApiResponse.failRsp("10043",request.getHeader("RequestId"),"发料仓库不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10043",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 + "'");
|
|
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){
|
|
if (count<=0){
|
|
|
- return ApiResponse.failRsp("10044",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10044",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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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 fSourceInterId = StringUtil.nvl(object.get("FSourceInterId"), "");
|
|
@@ -654,18 +655,18 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID2"), "{}"));
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID2"), "{}"));
|
|
|
String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
if ("".equals(whcode2)){
|
|
if ("".equals(whcode2)){
|
|
|
- return ApiResponse.failRsp("10043",request.getHeader("RequestId"),"物料所在仓库不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10043",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 + "'");
|
|
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){
|
|
if (count2<=0){
|
|
|
- return ApiResponse.failRsp("10044",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10044",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 + "'");
|
|
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 lineId = Integer.parseInt(StringUtil.nvl(object.get("lineId"), "0"));
|
|
|
int count4 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
|
|
int count4 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
|
|
|
if (count4<=0){
|
|
if (count4<=0){
|
|
|
- return ApiResponse.failRsp("10046",request.getHeader("RequestId"),"工单BOM在ERP没有不存在,明细ID:"+lineId+",请联系管理员!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10046",requestId,"工单BOM在ERP没有不存在,明细ID:"+lineId+",请联系管理员!");
|
|
|
}
|
|
}
|
|
|
Object[] data1 = baseDao.getFieldsDataByCondition("MakeMaterial", "mm_detno,mm_maid","mm_id in (" + lineId + ")");
|
|
Object[] data1 = baseDao.getFieldsDataByCondition("MakeMaterial", "mm_detno,mm_maid","mm_id in (" + lineId + ")");
|
|
|
maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
@@ -716,7 +717,7 @@ public class MESServiceImpl implements MESService {
|
|
|
String s = postProdInOut(bcpiid, bccaller, employee);
|
|
String s = postProdInOut(bcpiid, bccaller, employee);
|
|
|
logger.info("S=="+s);
|
|
logger.info("S=="+s);
|
|
|
if (s!=null){
|
|
if (s!=null){
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),bcpiclass+":"+bccode+",过账失败,请在ERP重新过账!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,bcpiclass+":"+bccode+",过账失败,请在ERP重新过账!");
|
|
|
}else {
|
|
}else {
|
|
|
if (count>0) {
|
|
if (count>0) {
|
|
|
String s1 = postProdInOut(llpiid, llcaller, employee);
|
|
String s1 = postProdInOut(llpiid, llcaller, employee);
|
|
@@ -724,15 +725,16 @@ public class MESServiceImpl implements MESService {
|
|
|
refreshTurnQty(maid,0);
|
|
refreshTurnQty(maid,0);
|
|
|
setBackQty(String.valueOf(maid),0);
|
|
setBackQty(String.valueOf(maid),0);
|
|
|
if (s1 != null) {
|
|
if (s1 != null) {
|
|
|
- return ApiResponse.successRsp("0", request.getHeader("RequestId"), llpiclass+":" + llcode + ",过账失败,请在ERP重新过账!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0", requestId, llpiclass+":" + llcode + ",过账失败,请在ERP重新过账!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),llpiclass+":"+llcode+","+bcpiclass+":"+bccode+ ",请在ERP查看!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,llpiclass+":"+llcode+","+bcpiclass+":"+bccode+ ",请在ERP查看!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> prodInOutMakeReturn(HttpServletRequest request) {
|
|
public ApiResult<String> prodInOutMakeReturn(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
Map<String, JSONArray> data = getData(request);
|
|
Map<String, JSONArray> data = getData(request);
|
|
|
JSONArray jsonArray = data.get("main");
|
|
JSONArray jsonArray = data.get("main");
|
|
|
int id=0;
|
|
int id=0;
|
|
@@ -753,7 +755,7 @@ public class MESServiceImpl implements MESService {
|
|
|
ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
|
maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
|
}else {
|
|
}else {
|
|
|
- return ApiResponse.failRsp("10057", request.getHeader("RequestId"), "工单在ERP不存在,请核对!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10057", requestId, "工单在ERP不存在,请核对!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
@@ -769,14 +771,23 @@ public class MESServiceImpl implements MESService {
|
|
|
tlpiclass = "委外退料单";
|
|
tlpiclass = "委外退料单";
|
|
|
tlcaller = "ProdInOut!OutsideReturn";
|
|
tlcaller = "ProdInOut!OutsideReturn";
|
|
|
}
|
|
}
|
|
|
|
|
+ String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
|
|
|
+ ApiResult<String> result = checkMESCode(requestId, fSelBillNo, tlpiclass);
|
|
|
|
|
+ if (result!=null){
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ ApiResult<String> result1 = checkMESCode(requestId, fSelBillNo, bcpiclass);
|
|
|
|
|
+ if (result1!=null){
|
|
|
|
|
+ return result1;
|
|
|
|
|
+ }
|
|
|
if (frob==0){
|
|
if (frob==0){
|
|
|
tlid = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
tlid = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
|
tlcode = baseDao.sGetMaxNumber(tlcaller, 2);
|
|
tlcode = baseDao.sGetMaxNumber(tlcaller, 2);
|
|
|
- sqls.add("INSERT INTO ProdInOut(pi_id, pi_inoutno, pi_date, pi_class,pi_invostatus,pi_invostatuscode,pi_recordman, pi_recorddate, pi_statuscode,pi_status,pi_updatedate,pi_updateman,pi_printstatuscode,pi_printstatus,pi_departmentcode,pi_departmentname,pi_emcode,pi_emname) VALUES ("+tlid+",'"+tlcode+"',to_date('"+jsonObject2.get("Fdate")+"','yyyy-MM-dd HH24:mi:ss'),'"+tlpiclass+"','在录入','ENTERING','"+map5.get("FName")+"',to_date('"+jsonObject2.get("Fdate")+"','yyyy-MM-dd HH24:mi:ss'),'UNPOST','未过账',sysdate,'"+map5.get("FName")+"','UNPRINT','未打印','"+map1.get("FNumber")+"','"+map1.get("FName")+"','"+map4.get("FNumber")+"','"+map4.get("FName")+"')");
|
|
|
|
|
|
|
+ sqls.add("INSERT INTO ProdInOut(pi_id, pi_inoutno, pi_date, pi_class,pi_invostatus,pi_invostatuscode,pi_recordman, pi_recorddate, pi_statuscode,pi_status,pi_updatedate,pi_updateman,pi_printstatuscode,pi_printstatus,pi_departmentcode,pi_departmentname,pi_emcode,pi_emname,pi_mescode) VALUES ("+tlid+",'"+tlcode+"',to_date('"+jsonObject2.get("Fdate")+"','yyyy-MM-dd HH24:mi:ss'),'"+tlpiclass+"','在录入','ENTERING','"+map5.get("FName")+"',to_date('"+jsonObject2.get("Fdate")+"','yyyy-MM-dd HH24:mi:ss'),'UNPOST','未过账',sysdate,'"+map5.get("FName")+"','UNPRINT','未打印','"+map1.get("FNumber")+"','"+map1.get("FName")+"','"+map4.get("FNumber")+"','"+map4.get("FName")+"','"+fSelBillNo+"')");
|
|
|
}
|
|
}
|
|
|
id = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
id = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
|
code = baseDao.sGetMaxNumber(bccaller, 2);
|
|
code = baseDao.sGetMaxNumber(bccaller, 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_inoutman,pi_type) values ("+id+",'"+code+"','"+bcpiclass+"',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")+"','库存转移')");
|
|
|
|
|
|
|
+ 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_inoutman,pi_type,pi_mescode) values ("+id+",'"+code+"','"+bcpiclass+"',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")+"','库存转移','"+fSelBillNo+"')");
|
|
|
}
|
|
}
|
|
|
Object[] warehouses=null;
|
|
Object[] warehouses=null;
|
|
|
Object[] warehouses2=null;
|
|
Object[] warehouses2=null;
|
|
@@ -787,33 +798,33 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
|
if ("".equals(itemNo)){
|
|
if ("".equals(itemNo)){
|
|
|
- return ApiResponse.failRsp("10051",request.getHeader("RequestId"),"物料不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10051",requestId,"物料不能为空!");
|
|
|
}
|
|
}
|
|
|
Double qty =Double.parseDouble(StringUtil.nvl(object.get("FAuxQty"), ""));
|
|
Double qty =Double.parseDouble(StringUtil.nvl(object.get("FAuxQty"), ""));
|
|
|
if ("".equals(qty)){
|
|
if ("".equals(qty)){
|
|
|
- return ApiResponse.failRsp("10052",request.getHeader("RequestId"),"实发数量不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10052",requestId,"实发数量不能为空!");
|
|
|
}
|
|
}
|
|
|
String fnote = StringUtil.nvl(object.get("Fnote"), "");
|
|
String fnote = StringUtil.nvl(object.get("Fnote"), "");
|
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FSCStockID1")));
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FSCStockID1")));
|
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
|
String whname = StringUtil.nvl(map1.get("FName"), "");
|
|
String whname = StringUtil.nvl(map1.get("FName"), "");
|
|
|
if ("".equals(whcode)){
|
|
if ("".equals(whcode)){
|
|
|
- return ApiResponse.failRsp("10053",request.getHeader("RequestId"),"仓库编号不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10053",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 + "'");
|
|
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){
|
|
if (count<=0){
|
|
|
- return ApiResponse.failRsp("10054",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10054",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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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"), "{}"));
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.nvl(object.get("FSCStockID2"), "{}"));
|
|
|
String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
String whname2 = StringUtil.nvl(map2.get("FName"), "");
|
|
String whname2 = StringUtil.nvl(map2.get("FName"), "");
|
|
|
if ("".equals(whcode2)){
|
|
if ("".equals(whcode2)){
|
|
|
- return ApiResponse.failRsp("10055",request.getHeader("RequestId"),"物料退回仓库不能为空!");
|
|
|
|
|
|
|
+ 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 + "'");
|
|
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){
|
|
if (count2<=0){
|
|
|
- return ApiResponse.failRsp("10056",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ 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 + "'");
|
|
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 + "'");
|
|
|
|
|
|
|
@@ -822,7 +833,7 @@ public class MESServiceImpl implements MESService {
|
|
|
Object lineId = object.get("lineId");
|
|
Object lineId = object.get("lineId");
|
|
|
int count1 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
|
|
int count1 = baseDao.getCount("select count(1) from MakeMaterial where mm_id in (" + lineId + ")");
|
|
|
if (count1<=0){
|
|
if (count1<=0){
|
|
|
- return ApiResponse.failRsp("10075",request.getHeader("RequestId"),"工单BOM不存在或ID不一致,请联系管理员处理!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10075",requestId,"工单BOM不存在或ID不一致,请联系管理员处理!");
|
|
|
}
|
|
}
|
|
|
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[] 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+")");
|
|
|
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]+")");
|
|
@@ -865,23 +876,26 @@ public class MESServiceImpl implements MESService {
|
|
|
String s1 = postProdInOut(tlid, tlcaller, employee);
|
|
String s1 = postProdInOut(tlid, tlcaller, employee);
|
|
|
logger.info("S1==" + s1);
|
|
logger.info("S1==" + s1);
|
|
|
if (s1 != null) {
|
|
if (s1 != null) {
|
|
|
- return ApiResponse.successRsp("0", request.getHeader("RequestId"), tlpiclass+":" + tlcode + ",过账失败,请在ERP重新过账!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0", requestId, tlpiclass+":" + tlcode + ",过账失败,请在ERP重新过账!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
String s = postProdInOut(id, bccaller, employee);
|
|
String s = postProdInOut(id, bccaller, employee);
|
|
|
logger.info("S=="+s);
|
|
logger.info("S=="+s);
|
|
|
if (s!=null){
|
|
if (s!=null){
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),bcpiclass+":"+code+",过账失败,请在ERP重新过账!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,bcpiclass+":"+code+",过账失败,请在ERP重新过账!");
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),tlpiclass+":"+tlcode+","+bcpiclass+":"+code+",请在ERP查看!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,tlpiclass+":"+tlcode+","+bcpiclass+":"+code+",请在ERP查看!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> prodInOutAppropriationOut(HttpServletRequest request) {
|
|
public ApiResult<String> prodInOutAppropriationOut(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
Map<String, JSONArray> data = getData(request);
|
|
Map<String, JSONArray> data = getData(request);
|
|
|
JSONArray jsonArray = data.get("main");
|
|
JSONArray jsonArray = data.get("main");
|
|
|
int id=0;
|
|
int id=0;
|
|
|
String code="";
|
|
String code="";
|
|
|
|
|
+ String picaller="ProdInOut!AppropriationOut";
|
|
|
|
|
+ String piclass="拨出单";
|
|
|
List<String> sqls = new ArrayList<>();
|
|
List<String> sqls = new ArrayList<>();
|
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
for (int i = 0; i <jsonArray.size() ; i++) {
|
|
|
JSONObject jsonObject2 = JSON.parseObject(StringUtil.nvl(jsonArray.get(i), ""));
|
|
JSONObject jsonObject2 = JSON.parseObject(StringUtil.nvl(jsonArray.get(i), ""));
|
|
@@ -890,9 +904,14 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map3 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FFManagerID")));
|
|
Map<Object, Object> map3 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FFManagerID")));
|
|
|
Map<Object, Object> map4 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FSManagerID")));
|
|
Map<Object, Object> map4 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FSManagerID")));
|
|
|
Map<Object, Object> map5 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FBillerID")));
|
|
Map<Object, Object> map5 = JSONUtil.toMap(StringUtil.valueOf(jsonObject2.get("FBillerID")));
|
|
|
|
|
+ String fSelBillNo = StringUtil.nvl(jsonObject2.get("FSelBillNo"), "");
|
|
|
|
|
+ ApiResult<String> result = checkMESCode(requestId, fSelBillNo, piclass);
|
|
|
|
|
+ if (result!=null){
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
id = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
id = baseDao.getSeqId("PRODINOUT_SEQ");
|
|
|
- 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','未打印','"+map2.get("FName")+"','"+map3.get("FName")+"')");
|
|
|
|
|
|
|
+ code = baseDao.sGetMaxNumber(picaller, 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,pi_mescode) values ("+id+ ",'"+code+"','"+piclass+"',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")+"','"+map3.get("FName")+"','"+fSelBillNo+"')");
|
|
|
}
|
|
}
|
|
|
JSONArray array = data.get("detail");
|
|
JSONArray array = data.get("detail");
|
|
|
Object[] warehouses=null;
|
|
Object[] warehouses=null;
|
|
@@ -903,32 +922,32 @@ public class MESServiceImpl implements MESService {
|
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
Map<Object, Object> map = JSONUtil.toMap(StringUtil.valueOf(object.get("FItemID")));
|
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
String itemNo = StringUtil.nvl(map.get("FNumber"), "");
|
|
|
if ("".equals(itemNo)){
|
|
if ("".equals(itemNo)){
|
|
|
- return ApiResponse.failRsp("10061",request.getHeader("RequestId"),"物料不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10061",requestId,"物料不能为空!");
|
|
|
}
|
|
}
|
|
|
String qty = StringUtil.nvl(object.get("Fauxqty"), "");
|
|
String qty = StringUtil.nvl(object.get("Fauxqty"), "");
|
|
|
if ("".equals(qty)){
|
|
if ("".equals(qty)){
|
|
|
- return ApiResponse.failRsp("10062",request.getHeader("RequestId"),"实转数量不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10062",requestId,"实转数量不能为空!");
|
|
|
}
|
|
}
|
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FSCStockID1")));
|
|
Map<Object, Object> map1 = JSONUtil.toMap(StringUtil.valueOf(object.get("FSCStockID1")));
|
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
String whcode = StringUtil.nvl(map1.get("FNumber"), "");
|
|
|
String whname = StringUtil.nvl(map1.get("FName"), "");
|
|
String whname = StringUtil.nvl(map1.get("FName"), "");
|
|
|
if ("".equals(whcode)){
|
|
if ("".equals(whcode)){
|
|
|
- return ApiResponse.failRsp("10063",request.getHeader("RequestId"),"发货仓库不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10063",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 + "'");
|
|
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){
|
|
if (count<=0){
|
|
|
- return ApiResponse.failRsp("10064",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10064",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", "ct_statuscode='AUDITED' and ct_caller='MESWarehouse' and 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.valueOf(object.get("FDCStockID1")));
|
|
Map<Object, Object> map2 = JSONUtil.toMap(StringUtil.valueOf(object.get("FDCStockID1")));
|
|
|
String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
String whcode2 = StringUtil.nvl(map2.get("FNumber"), "");
|
|
|
String whname2 = StringUtil.nvl(map2.get("FName"), "");
|
|
String whname2 = StringUtil.nvl(map2.get("FName"), "");
|
|
|
if ("".equals(whcode2)){
|
|
if ("".equals(whcode2)){
|
|
|
- return ApiResponse.failRsp("10065",request.getHeader("RequestId"),"收货仓库不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10065",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 + "'");
|
|
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){
|
|
if (count2<=0){
|
|
|
- return ApiResponse.failRsp("10066",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10066",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 + "'");
|
|
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 + "'");
|
|
|
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]+"')");
|
|
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]+"')");
|
|
@@ -941,11 +960,12 @@ public class MESServiceImpl implements MESService {
|
|
|
sqls.add("update prodinout set pi_purpose='"+warehouses2[0]+"',pi_purposename='"+warehouses2[1]+"' where pi_id="+id);
|
|
sqls.add("update prodinout set pi_purpose='"+warehouses2[0]+"',pi_purposename='"+warehouses2[1]+"' where pi_id="+id);
|
|
|
}
|
|
}
|
|
|
baseDao.execute(sqls);
|
|
baseDao.execute(sqls);
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"拨出单:"+code+",请在ERP查看!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"拨出单:"+code+",请在ERP查看!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> makeCheckOutStock(HttpServletRequest request) {
|
|
public ApiResult<String> makeCheckOutStock(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
try {
|
|
try {
|
|
|
String data = PSHttpUtils.readRaw(request.getInputStream());
|
|
String data = PSHttpUtils.readRaw(request.getInputStream());
|
|
|
JSONArray jsonArray = JSON.parseArray(data);
|
|
JSONArray jsonArray = JSON.parseArray(data);
|
|
@@ -953,54 +973,55 @@ public class MESServiceImpl implements MESService {
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
String whcode = StringUtil.nvl(jsonObject.getString("outwhcode"), "");
|
|
String whcode = StringUtil.nvl(jsonObject.getString("outwhcode"), "");
|
|
|
if ("".equals(whcode)){
|
|
if ("".equals(whcode)){
|
|
|
- return ApiResponse.failRsp("10081",request.getHeader("RequestId"),"拨出仓库不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10081",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 + "'");
|
|
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){
|
|
if (count<=0){
|
|
|
- return ApiResponse.failRsp("10082",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10082",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 + "'");
|
|
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);
|
|
jsonObject.put("outwhcode",outwhcode);
|
|
|
String whcode1 = StringUtil.nvl(jsonObject.getString("inwhcode"), "");
|
|
String whcode1 = StringUtil.nvl(jsonObject.getString("inwhcode"), "");
|
|
|
if ("".equals(whcode1)){
|
|
if ("".equals(whcode1)){
|
|
|
- return ApiResponse.failRsp("10083",request.getHeader("RequestId"),"拨入仓库不能为空!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10083",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 + "'");
|
|
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){
|
|
if (count1<=0){
|
|
|
- return ApiResponse.failRsp("10084",request.getHeader("RequestId"),"MES仓库编号在ERP没有对应关系,请联系管理员新增!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10084",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 + "'");
|
|
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);
|
|
jsonObject.put("inwhcode",inwhcode);
|
|
|
}
|
|
}
|
|
|
String msg = baseDao.callProcedure("USER_CHECKOUTSTOCK", new Object[] {null,JSON.toJSONString(jsonArray)});
|
|
String msg = baseDao.callProcedure("USER_CHECKOUTSTOCK", new Object[] {null,JSON.toJSONString(jsonArray)});
|
|
|
if (msg != null && !msg.trim().equals("")){
|
|
if (msg != null && !msg.trim().equals("")){
|
|
|
- return ApiResponse.failRsp("10085",request.getHeader("RequestId"),msg);
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10085",requestId,msg);
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"校验通过!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"校验通过!");
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
- return ApiResponse.failRsp("10086",request.getHeader("RequestId"),e.getMessage());
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10086",requestId,e.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public ApiResult<String> makeECNCheck(HttpServletRequest request) {
|
|
public ApiResult<String> makeECNCheck(HttpServletRequest request) {
|
|
|
|
|
+ String requestId = request.getHeader("RequestId");
|
|
|
JSONObject jsonData = getJsonData(request);
|
|
JSONObject jsonData = getJsonData(request);
|
|
|
if (jsonData!=null){
|
|
if (jsonData!=null){
|
|
|
String makeCode = StringUtil.nvl(jsonData.get("MakeCode"), "");
|
|
String makeCode = StringUtil.nvl(jsonData.get("MakeCode"), "");
|
|
|
Object mcCode = baseDao.getFieldDataByCondition("makematerialchange", "wm_concat(mc_code)",
|
|
Object mcCode = baseDao.getFieldDataByCondition("makematerialchange", "wm_concat(mc_code)",
|
|
|
"mc_id in (select md_mcid from makematerialchangedet where md_makecode='"+makeCode+"' and nvl(md_didstatus,' ')<>'执行成功')");
|
|
"mc_id in (select md_mcid from makematerialchangedet where md_makecode='"+makeCode+"' and nvl(md_didstatus,' ')<>'执行成功')");
|
|
|
if (mcCode!=null){
|
|
if (mcCode!=null){
|
|
|
- return ApiResponse.failRsp("10091",request.getHeader("RequestId"),"ERP有未执行的制造单ECN:"+mcCode);
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10091",requestId,"ERP有未执行的制造单ECN:"+mcCode);
|
|
|
}
|
|
}
|
|
|
Object ecnCode = baseDao.getFieldDataByCondition("ecn", "wm_concat(ecn_code)",
|
|
Object ecnCode = baseDao.getFieldDataByCondition("ecn", "wm_concat(ecn_code)",
|
|
|
"nvl(ecn_didstatus,' ')<>'已执行' and ecn_id in (select ed_ecnid from ecndetail left join make on ed_boid=ma_bomid where ma_code='"+makeCode+"')");
|
|
"nvl(ecn_didstatus,' ')<>'已执行' and ecn_id in (select ed_ecnid from ecndetail left join make on ed_boid=ma_bomid where ma_code='"+makeCode+"')");
|
|
|
if (ecnCode!=null){
|
|
if (ecnCode!=null){
|
|
|
- return ApiResponse.failRsp("10092",request.getHeader("RequestId"),"ERP有未执行的ECN:"+ecnCode);
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10092",requestId,"ERP有未执行的ECN:"+ecnCode);
|
|
|
}
|
|
}
|
|
|
- return ApiResponse.successRsp("0",request.getHeader("RequestId"),"校验通过!");
|
|
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"校验通过!");
|
|
|
}else {
|
|
}else {
|
|
|
- return ApiResponse.failRsp("10093",request.getHeader("RequestId"),"参数异常!");
|
|
|
|
|
|
|
+ return ApiResponse.failRsp("10093",requestId,"参数异常!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1037,6 +1058,18 @@ public class MESServiceImpl implements MESService {
|
|
|
return jsonObject;
|
|
return jsonObject;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private ApiResult<String> checkMESCode(String requestId,String mesNo,String piclass){
|
|
|
|
|
+ if ("".equals(mesNo)){
|
|
|
|
|
+ return ApiResponse.failRsp("10100", requestId, "MES单号不能为空!");
|
|
|
|
|
+ }
|
|
|
|
|
+ int count = baseDao.getCount("select count(1) from prodinout where pi_class='" + piclass + "' and pi_mescode='" + mesNo + "'");
|
|
|
|
|
+ if (count>0){
|
|
|
|
|
+ Object code = baseDao.getFieldDataByCondition("prodinout", "pi_inoutno", "pi_class='" + piclass + "' and pi_mescode='" + mesNo + "'");
|
|
|
|
|
+ return ApiResponse.successRsp("0",requestId,"MES单号:"+mesNo+"已存在,请在ERP查看"+piclass+",单据编号:"+code);
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private synchronized String postProdInOut(int pi_id, String caller,Employee employee) {
|
|
private synchronized String postProdInOut(int pi_id, String caller,Employee employee) {
|
|
|
// 增加系统参数 出入库日期小于等于当前日期才允许过账 maz 2018020006
|
|
// 增加系统参数 出入库日期小于等于当前日期才允许过账 maz 2018020006
|
|
|
if (baseDao.isDBSetting("sys", "limitPostAfter")) {
|
|
if (baseDao.isDBSetting("sys", "limitPostAfter")) {
|