| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.LocNormal; |
| | | import com.zy.asrs.mapper.LocNormalMapper; |
| | | import com.zy.asrs.mapper.OutStockMapper; |
| | |
| | | if (list.size() > 0) { |
| | | for (Integer i = 0; i < list.size(); i++) { |
| | | if (!Cools.isEmpty(list.get(i).getSupplier())) { // 存在入库单号的才进行erp更新 |
| | | String sql = "update CPICMO set FAuxCommitQty = (FAuxCommitQty + {0,number,#}) where 1=1 and Fnumber = ''{1}'' and FBillNo = ''{2}''"; |
| | | sql = MessageFormat.format(sql, list.get(i).getAnfme(), list.get(i).getMatnr(), list.get(i).getSupplier()); |
| | | if (erpSqlServer.update(sql) > 0) { |
| | | sql = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''"; |
| | | sql = MessageFormat.format(sql, list.get(i).getMatnr(), list.get(i).getSupplier()); |
| | | List<CPICMO> select = erpSqlServer.select(sql, CPICMO.class); |
| | | CPICMO cpicmo = select.get(0); |
| | | boolean complete = false; |
| | | if (cpicmo.getFQty() > 0) { |
| | | if (cpicmo.getFAuxCommitQty() == cpicmo.getFQty()) { |
| | | complete = true; |
| | | String sqlSelect = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''"; |
| | | sqlSelect = MessageFormat.format(sqlSelect, list.get(i).getMatnr(), list.get(i).getSupplier()); |
| | | List<CPICMO> CPICMOList = erpSqlServer.select(sqlSelect,CPICMO.class); |
| | | if (CPICMOList.size() > 0) { // 说明erp有对应的入库单 |
| | | String sql = "update CPICMO set FAuxCommitQty = (FAuxCommitQty + {0,number,#}) where 1=1 and Fnumber = ''{1}'' and FBillNo = ''{2}''"; |
| | | sql = MessageFormat.format(sql, list.get(i).getAnfme(), list.get(i).getMatnr(), list.get(i).getSupplier()); |
| | | if (erpSqlServer.update(sql) > 0) { |
| | | sql = "select * from CPICMO where 1=1 and Fnumber = ''{0}'' and FBillNo = ''{1}''"; |
| | | sql = MessageFormat.format(sql, list.get(i).getMatnr(), list.get(i).getSupplier()); |
| | | List<CPICMO> select = erpSqlServer.select(sql, CPICMO.class); |
| | | CPICMO cpicmo = select.get(0); |
| | | boolean complete = false; |
| | | if (cpicmo.getFQty() > 0) { |
| | | if (cpicmo.getFAuxCommitQty() == cpicmo.getFQty()) { |
| | | complete = true; |
| | | } |
| | | } else { |
| | | if (cpicmo.getFAuxCommitQty() == cpicmo.getFAuxQty()) { |
| | | complete = true; |
| | | } |
| | | } |
| | | } else { |
| | | if (cpicmo.getFAuxCommitQty() == cpicmo.getFAuxQty()) { |
| | | complete = true; |
| | | if (complete) { |
| | | if (!completeCPakIn(list.get(i).getSupplier(), list.get(i).getMatnr())) { |
| | | log.error("{}平仓入库单标记完成失败", list.get(i).getSupplier()); |
| | | } |
| | | } |
| | | } |
| | | if (complete) { |
| | | if (!completeCPakIn(list.get(i).getSupplier(), list.get(i).getMatnr())) { |
| | | log.error("{}平仓入库单标记完成失败", list.get(i).getSupplier()); |
| | | } |
| | | } |
| | | } else { |
| | | throw new CoolException("ERP查询不到对应通知单"); |
| | | } |
| | | } else { |
| | | throw new CoolException("通知单号不可为空"); |
| | | } |
| | | } |
| | | // 平仓入库逻辑 |
| | | baseMapper.locNormalIn(list); |
| | | } |
| | | // 平仓入库逻辑 |
| | | baseMapper.locNormalIn(list); |
| | | } |
| | | |
| | | /** |