|
|
@@ -489,12 +489,12 @@ public class MESServiceImpl implements MESService {
|
|
|
return ApiResponse.failRsp("10025",requestId,"报废数量不能为空!");
|
|
|
}
|
|
|
//临时逻辑 重新计算报废数量
|
|
|
- int coun = baseDao.getCountByCondition("make", "ma_code='" + prodNo + "' and to_char(ma_date,'yyyyMM')<'202212'");
|
|
|
- if (baseDao.isDBSetting("MakeScrap","overQtySuccess")&&coun>0) {
|
|
|
- qty = Double.parseDouble(StringUtil.nvl(baseDao.getFieldDataByCondition("makematerial left join make on mm_maid=ma_id", "nvl(mm_havegetqty,0)-nvl(mm_returnmqty,0)+nvl(mm_addqty,0)+nvl(mm_scrapqty,0)-nvl(mm_oneuseqty,0)*nvl(ma_madeqty,0)", "mm_id=" + lineId), "0"));
|
|
|
- /*if (mmqty < qty) {
|
|
|
+ //int coun = baseDao.getCountByCondition("make", "ma_code='" + prodNo + "' and to_char(ma_date,'yyyyMM')<'202212'");
|
|
|
+ if (baseDao.isDBSetting("MakeScrap","overQtySuccess")) {
|
|
|
+ double mmqty = Double.parseDouble(StringUtil.nvl(baseDao.getFieldDataByCondition("makematerial left join make on mm_maid=ma_id", "nvl(mm_havegetqty,0)-nvl(mm_returnmqty,0)+nvl(mm_addqty,0)+nvl(mm_scrapqty,0)-nvl(mm_oneuseqty,0)*nvl(ma_madeqty,0)", "mm_id=" + lineId), "0"));
|
|
|
+ if (mmqty < qty) {
|
|
|
qty = mmqty;
|
|
|
- }*/
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
String reason = StringUtil.nvl(object.get("reason"), "");
|
|
|
@@ -1217,13 +1217,17 @@ public class MESServiceImpl implements MESService {
|
|
|
if (count<=0){
|
|
|
return ApiResponse.failRsp("10094",requestId,"工单:"+makeCode+"在ERP不存在,请核对!");
|
|
|
}
|
|
|
- Object[] data = baseDao.getFieldsDataByCondition("make", "ma_canmadeqty,ma_code,ma_qty,ma_madeqty,ma_tomadeqty", "ma_code='" + makeCode + "'");
|
|
|
+ Object[] data = baseDao.getFieldsDataByCondition("make", "ma_canmadeqty,ma_code,ma_qty,ma_madeqty,ma_tomadeqty,ma_id", "ma_code='" + makeCode + "'");
|
|
|
if (data!=null&&data.length>0) {
|
|
|
- Object canmadeqty = baseDao.getFieldDataByCondition("make", "(select min(case when NVL(mm_havegetqty,0)-NVL(mm_scrapqty,0)>=mm_qty then ma_qty else floor((nvl(mm_havegetqty, 0)-nvl(mm_scrapqty,0))*1.0/mm_oneuseqty)end) from makematerial where mm_maid=ma_id and nvl(mm_materialstatus,' ')=' ' and mm_oneuseqty>0 and mm_oneuseqty*ma_qty<=mm_qty+0.1 and nvl(mm_cp_user,0)=0)","ma_code='" + makeCode + "'");
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("code",data[1]);
|
|
|
- //备料齐套数量
|
|
|
- map.put("canmadeqty",canmadeqty);
|
|
|
+ if (baseDao.checkIf("makematerial","nvl(mm_cp_user,0)=0 and nvl(mm_qty,0)>0 and mm_maid="+data[5])){
|
|
|
+ Object canmadeqty = baseDao.getFieldDataByCondition("make", "(select min(case when NVL(mm_havegetqty,0)-NVL(mm_scrapqty,0)>=mm_qty then ma_qty else floor((nvl(mm_havegetqty, 0)-nvl(mm_scrapqty,0))*1.0/mm_oneuseqty)end) from makematerial where mm_maid=ma_id and nvl(mm_materialstatus,' ')=' ' and mm_oneuseqty>0 and mm_oneuseqty*ma_qty<=mm_qty+0.1 and nvl(mm_cp_user,0)=0)","ma_code='" + makeCode + "'");
|
|
|
+ //备料齐套数量
|
|
|
+ map.put("canmadeqty",canmadeqty);
|
|
|
+ }else {
|
|
|
+ map.put("canmadeqty",data[2]);
|
|
|
+ }
|
|
|
//工单数量
|
|
|
map.put("qty",data[2]);
|
|
|
//完工数量
|
|
|
@@ -1441,11 +1445,14 @@ public class MESServiceImpl implements MESService {
|
|
|
JSONArray detail = data.get("detail");
|
|
|
if(detail!=null&&detail.size()>0){
|
|
|
String macode = StringUtil.valueOf(JSON.parseObject(StringUtil.nvl(detail.get(0), "{}")).get("FICMOBillNo"));
|
|
|
- Object[] data1 = baseDao.getFieldsDataByCondition("Make", "ma_tasktype,ma_id,ma_status", "ma_code in ('" + macode + "')");
|
|
|
+ Object[] data1 = baseDao.getFieldsDataByCondition("Make", "ma_tasktype,ma_id,ma_status,ma_finishstatus", "ma_code in ('" + macode + "')");
|
|
|
if (data1!=null&&data1.length>0) {
|
|
|
if ("已结案".equals(StringUtil.nvl(data1[2], ""))){
|
|
|
return ApiResponse.failRsp("10041", requestId, "工单:"+macode+"在ERP已结案,不允许领料!");
|
|
|
}
|
|
|
+ if ("已完工".equals(StringUtil.nvl(data1[3], ""))){
|
|
|
+ return ApiResponse.failRsp("10041", requestId, "工单:"+macode+"在ERP已完工,不允许领料!");
|
|
|
+ }
|
|
|
ma_tasktype = StringUtil.nvl(data1[0], "");
|
|
|
maid = Integer.parseInt(StringUtil.nvl(data1[1], "0"));
|
|
|
}else {
|