|
|
@@ -2,6 +2,7 @@ package com.uas.eis.serviceImpl;
|
|
|
|
|
|
import com.uas.eis.core.config.SpObserver;
|
|
|
import com.uas.eis.dao.BaseDao;
|
|
|
+import com.uas.eis.dao.SqlRowList;
|
|
|
import com.uas.eis.dto.DataCenter;
|
|
|
import com.uas.eis.entity.ErrorMessage;
|
|
|
import com.uas.eis.exception.ApiSystemException;
|
|
|
@@ -175,6 +176,44 @@ public class MESDataServiceImpl implements MESDataService {
|
|
|
return relist;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Map<Object,Object>> deletePackage(String accessKey, String requestId, String data) {
|
|
|
+ String AE_MASTER = checkAccessKey(accessKey, requestId);
|
|
|
+ List<Map<Object, Object>> maps = BaseUtil.parseGridStoreToMaps(data);
|
|
|
+ SpObserver.putSp(AE_MASTER);
|
|
|
+ List<Map<Object, Object>> relist = new ArrayList<>();
|
|
|
+ for (Map<Object, Object> map : maps) {
|
|
|
+ Map<Object, Object> remap = new HashMap<>();
|
|
|
+ String remark = "";
|
|
|
+ String pa_outboxcode = map.get("PA_OUTBOXCODE").toString();
|
|
|
+ int cn = baseDao.getJdbcTemplate().queryForObject("select count(1) from "+AE_MASTER+".package where pa_outboxcode=? ",Integer.class,map.get("PA_OUTBOXCODE"));
|
|
|
+ if(cn>0){
|
|
|
+ SqlRowList rs=baseDao.queryForRowSet("select pd_makecode,count(1) num from "+AE_MASTER+".packagedetail left join "+AE_MASTER+".makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode where pd_outboxcode='" + map.get("PA_OUTBOXCODE") + "' group by pd_makecode");
|
|
|
+ while (rs.next()){
|
|
|
+ String ma_code = rs.getString("pd_makecode");
|
|
|
+ String num = rs.getString("num");
|
|
|
+ baseDao.execute("delete from "+AE_MASTER+".makeprocess where mp_sncode in (select ms_sncode from "+AE_MASTER+".makeserial where ms_outboxcode='" + pa_outboxcode + "' and ms_makecode='" + ma_code + "') and mp_makecode='" + ma_code + "' ");
|
|
|
+ baseDao.execute("delete from "+AE_MASTER+".steppassed where sp_sncode in (select ms_sncode from "+AE_MASTER+".makeserial where ms_outboxcode='" + pa_outboxcode + "' and ms_makecode='" + ma_code + "') and sp_makecode='" + ma_code + "' ");
|
|
|
+ baseDao.execute("update "+AE_MASTER+".makecraftdetail set mcd_inqty=mcd_inqty-" + num + ",mcd_outqty=mcd_outqty-" + num + ",mcd_okqty=mcd_okqty-" + num + " where mcd_macode='" + ma_code + "' ");
|
|
|
+ //扣减已完工数
|
|
|
+ baseDao.execute("update "+AE_MASTER+".make set ma_endqty=ma_endqty-(select count(1) from "+AE_MASTER+".makeserial where ms_outboxcode='" + pa_outboxcode + "' and ms_makecode='" + ma_code + "' and ms_status=2) where ma_code='" + ma_code + "'");
|
|
|
+ }
|
|
|
+ baseDao.execute("update "+AE_MASTER+".makeserial set ms_status=1,ms_outboxcode='' where ms_outboxcode='" + pa_outboxcode + "'");
|
|
|
+ baseDao.execute("update "+AE_MASTER+".package set pa_checkno='',pa_prodcode='',pa_packtype='',pa_salecode='',pa_packageqty=0,pa_totalqty=0,pa_currentqty=0,pa_status=0,PA_STANDARDQTY = 0 where pa_outboxcode='" + pa_outboxcode + "'");
|
|
|
+ baseDao.execute("delete from "+AE_MASTER+".packagedetail where pd_outboxcode='" + pa_outboxcode + "'");
|
|
|
+ baseDao.execute("delete from "+AE_MASTER+".labelprintlog where lpl_value='" + pa_outboxcode + "' and LPL_TYPE='卡通箱标'");
|
|
|
+ remap.put("result","箱号"+map.get("PA_OUTBOXCODE")+"解除成功");
|
|
|
+ }else{
|
|
|
+ remap.put("result","箱号"+map.get("PA_OUTBOXCODE")+"不存在");
|
|
|
+ }
|
|
|
+ map.put("T_KEY",accessKey);
|
|
|
+ map.put("T_INDATE", Timestamp.valueOf(DateUtil.currentDateString(Constant.YMD_HMS)));
|
|
|
+ relist.add(remap);
|
|
|
+ }
|
|
|
+ SpObserver.putSp(username);
|
|
|
+ return relist;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<Map<Object,Object>> makeBadReason(String accessKey, String requestId, String data) {
|
|
|
String AE_MASTER = checkAccessKey(accessKey, requestId);
|