|  |  | 
 |  |  |             if (orderDetl.getProcessSts() == 1) { | 
 |  |  |                 flag = true; | 
 |  |  |             } | 
 |  |  |             if (param.getDocType() != 32) { | 
 |  |  |                 orderDetl.setProcessSts(3); | 
 |  |  |             } | 
 |  |  |             DetlDto dto = new DetlDto(orderDetl.getMatnr(), orderDetl.getBatch()); | 
 |  |  |             if (DetlDto.has(list, dto)) { | 
 |  |  |                 OrderDetl item = orderDetlService.selectItem(order.getId(), orderDetl.getMatnr(), orderDetl.getBatch(),orderDetl.getThreeCode(),orderDetl.getDeadTime()); | 
 |  |  | 
 |  |  |                         proSts = 3; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 proSts = 3; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 
 |  |  | 
 |  |  |         wrapper.in("source",docIds); | 
 |  |  |         Page<OrderDetl> page = orderDetlService.selectPage(new Page<>(curr, limit), wrapper); | 
 |  |  |         for (OrderDetl record : page.getRecords()) { | 
 |  |  |             Double sumAnfme = agvLocDetlService.getSumAnfme(record.getMatnr(), record.getThreeCode()); | 
 |  |  |             Double sumAnfme = agvLocDetlService.getSumAnfmeProcessed(record.getMatnr(), record.getThreeCode()); | 
 |  |  |             record.setStock(sumAnfme == null ? 0 : sumAnfme); | 
 |  |  |         } | 
 |  |  |  | 
 
 |  |  | 
 |  |  |         //货架码 | 
 |  |  |         private String suppCode; | 
 |  |  |  | 
 |  |  |         public LocDetlAdjust(String matnr, String batch, Double count, String orderNo,String threeCode, String deadTime, String suppCode) { | 
 |  |  |         // 工序 | 
 |  |  |         private Integer processSts; | 
 |  |  |  | 
 |  |  |         public LocDetlAdjust(String matnr, String batch, Double count, String orderNo,String threeCode, String deadTime, String suppCode, Integer processSts) { | 
 |  |  |             this.matnr = matnr; | 
 |  |  |             this.batch = batch; | 
 |  |  |             this.count = count; | 
 |  |  | 
 |  |  |             this.threeCode = threeCode; | 
 |  |  |             this.deadTime = deadTime; | 
 |  |  |             this.suppCode = suppCode; | 
 |  |  |             this.processSts = processSts; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             if (!exit) { | 
 |  |  |                 copyList.add(new LocDetlAdjustParam.LocDetlAdjust(adjust.getMatnr(), adjust.getBatch(), adjust.getCount(),adjust.getOrderNo(), adjust.getThreeCode(), adjust.getDeadTime(),adjust.getSuppCode())); | 
 |  |  |                 copyList.add(new LocDetlAdjustParam.LocDetlAdjust(adjust.getMatnr(), adjust.getBatch(), adjust.getCount(),adjust.getOrderNo(), adjust.getThreeCode(), adjust.getDeadTime(),adjust.getSuppCode(),adjust.getProcessSts())); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         list = copyList; | 
 
 |  |  | 
 |  |  |     @Select("select sum(a.anfme) as sum from agv_loc_detl a left join agv_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr} AND a.three_code = #{threeCode} AND a.process_sts = 1") | 
 |  |  |     Double selectSumAnfmeByMatnrProcess(@Param("matnr") String matnr,@Param("threeCode") String threeCode); | 
 |  |  |  | 
 |  |  |     @Select("select sum(a.anfme) as sum from agv_loc_detl a left join agv_loc_mast b on a.loc_no = b.loc_no where b.loc_sts = 'F' and a.matnr = #{matnr} AND a.three_code = #{threeCode} AND a.process_sts != 1 AND b.lev1 != 2") | 
 |  |  |     Double selectSumAnfmeByMatnrProcessed(@Param("matnr") String matnr,@Param("threeCode") String threeCode); | 
 |  |  |  | 
 |  |  |     @Select("select sum(a.anfme) as sum from agv_loc_detl a left join agv_loc_mast b on a.loc_no = b.loc_no where (b.loc_sts = 'F' or b.loc_sts = 'R') and b.floor = #{floor} and a.matnr = #{matnr} AND a.three_code = #{threeCode} AND a.process_sts != 1") | 
 |  |  |     Double selectSumAnfmeByMatnr2(@Param("matnr") String matnr,@Param("threeCode") String threeCode,@Param("floor") Integer floor); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |     int updateAnfme(@Param("locNo")String locNo, @Param("anfme")Double anfme, @Param("matnr")String matnr, @Param("batch")String batch, @Param("csocode")String csocode, @Param("isocode")String isocode); | 
 |  |  |  | 
 |  |  |     int updateAnfmeProcess(@Param("locNo")String locNo, @Param("anfme")Double anfme, @Param("matnr")String matnr, @Param("batch")String batch, @Param("csocode")String csocode, @Param("isocode")String isocode, @Param("process")Integer process); | 
 |  |  |  | 
 |  |  |     int deleteLocDetl(@Param("locNo")String locNo, @Param("anfme")Double anfme, @Param("matnr")String matnr, @Param("batch")String batch, @Param("csocode")String csocode, @Param("isocode")String isocode); | 
 |  |  |  | 
 |  |  |     AgvLocDetl selectLocdetl(@Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch, @Param("csocode")String csocode, @Param("isocode")String isocode); | 
 
 |  |  | 
 |  |  |  | 
 |  |  |     Double getSumAnfmeProcess(String matnr, String threeCode); | 
 |  |  |  | 
 |  |  |     Double getSumAnfmeProcessed(String matnr, String threeCode); | 
 |  |  |  | 
 |  |  |     Double getSumAnfmeDb(String matnr, String threeCode, Integer floor); | 
 |  |  |  | 
 |  |  |     Integer sum(); | 
 |  |  | 
 |  |  |      */ | 
 |  |  |     boolean updateAnfme(Double anfme, String locNo, String matnr, String batch, String csocode, String isocode); | 
 |  |  |  | 
 |  |  |     boolean updateAnfmeProcess(Double anfme, String locNo, String matnr, String batch, String csocode, String isocode,Integer process); | 
 |  |  |  | 
 |  |  |     public AgvLocDetl selectByLocNo(String locNo); | 
 |  |  |  | 
 |  |  |     public List<AgvLocDetl> selectByTaskDto(TaskDto taskDto); | 
 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Double getSumAnfmeProcessed(String matnr, String threeCode) { | 
 |  |  |         return this.baseMapper.selectSumAnfmeByMatnrProcessed(matnr, threeCode); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Double getSumAnfmeDb(String matnr, String threeCode,Integer floor) { | 
 |  |  |         return this.baseMapper.selectSumAnfmeByMatnr2(matnr, threeCode, floor); | 
 |  |  |     } | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     public boolean updateAnfmeProcess(Double anfme, String locNo, String matnr, String batch, String csocode, String isocode, Integer process) { | 
 |  |  |         EntityWrapper<AgvLocDetl> wrapper = new EntityWrapper<>(); | 
 |  |  |         wrapper.eq("loc_no", locNo); | 
 |  |  |         Utils.confirmOnlyMat(wrapper,matnr,batch,csocode,isocode); | 
 |  |  |         if (anfme <= 0) { | 
 |  |  |             return this.baseMapper.deleteLocDetl(locNo,anfme,matnr,batch,csocode,isocode) > 0; | 
 |  |  |         } else { | 
 |  |  |             AgvLocDetl agvLocDetl = this.selectOne(wrapper); | 
 |  |  |             agvLocDetl.setAnfme(anfme); | 
 |  |  |             agvLocDetl.setModiTime(new Date()); | 
 |  |  |             return this.baseMapper.updateAnfmeProcess(locNo,anfme,matnr,batch,csocode,isocode,process) > 0; | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void wapperSetCondition(Wrapper wrapper,String column, String condition){ | 
 |  |  |         if(Cools.isEmpty(condition)){ | 
 
 |  |  | 
 |  |  |             throw new CoolException("当前"+agvLocMast.getBarcode()+"货架码已在工作档中"); | 
 |  |  |         } | 
 |  |  |         //检索库位,选择合适的库位 | 
 |  |  |         AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,true); | 
 |  |  |         AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,false); | 
 |  |  |         if (Cools.isEmpty(locMast)) { | 
 |  |  |             throw new CoolException("当前楼层没有空库位"); | 
 |  |  |         } | 
 
 |  |  | 
 |  |  |                 LocDetlAdjustParam.LocDetlAdjust adjust = iterator1.next(); | 
 |  |  |                 if (adjust.getCount() == 0) { continue; } | 
 |  |  |                 if (locDetl.getMatnr().equals(adjust.getMatnr()) && Cools.eq(locDetl.getBatch(), adjust.getBatch()) && Cools.eq(locDetl.getSuppCode(),adjust.getSuppCode()) && Cools.eq(locDetl.getThreeCode(),adjust.getThreeCode()) && Cools.eq(locDetl.getDeadTime(),adjust.getDeadTime())) { | 
 |  |  |                     if (!locDetl.getAnfme().equals(adjust.getCount())) { | 
 |  |  |                     if (!locDetl.getAnfme().equals(adjust.getCount()) || !locDetl.getProcessSts().equals(adjust.getProcessSts())) { | 
 |  |  |                         // todo 盘点记录 | 
 |  |  |                         // 修改库存 | 
 |  |  |                         if (!agvLocDetlService.updateAnfme(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(),locDetl.getThreeCode(),locDetl.getDeadTime())) { | 
 |  |  |                         if (!agvLocDetlService.updateAnfmeProcess(adjust.getCount(), locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(),locDetl.getThreeCode(),locDetl.getDeadTime(),adjust.getProcessSts())) { | 
 |  |  |                             throw new CoolException(locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "序列码修改数量失败"); | 
 |  |  |                         } | 
 |  |  |                         // 保存调整记录 | 
 |  |  | 
 |  |  |         // 删除库存 | 
 |  |  |         for (AgvLocDetl locDetl : locDetls) { | 
 |  |  |             // todo 盘点记录 | 
 |  |  |             if (!agvLocDetlService.updateAnfme(-1.0D, locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(),locDetl.getThreeCode(),locDetl.getDeadTime())) { | 
 |  |  |             if (!agvLocDetlService.updateAnfmeProcess(-1.0D, locDetl.getLocNo(), locDetl.getMatnr(), locDetl.getBatch(),locDetl.getThreeCode(),locDetl.getDeadTime(),locDetl.getProcessSts())) { | 
 |  |  |                 throw new CoolException("删除" + locDetl.getLocNo() + "库位," + locDetl.getMatnr() + "商品," + locDetl.getBatch() + "序列码库存明细失败"); | 
 |  |  |             } | 
 |  |  |             // 保存调整记录 | 
 
 |  |  | 
 |  |  |         switch (agvWrkMast.getIoType()) { | 
 |  |  |             case 108: | 
 |  |  |             case 12: | 
 |  |  |             case 57: | 
 |  |  |                 agvTaskCreateParam.setTaskTyp("F06"); | 
 |  |  |                 break; | 
 |  |  |             case 109: | 
 
 |  |  | 
 |  |  |         </choose> | 
 |  |  |     </update> | 
 |  |  |  | 
 |  |  |     <update id="updateAnfmeProcess"> | 
 |  |  |         update agv_loc_detl | 
 |  |  |         set anfme = #{anfme} | 
 |  |  |         where 1=1 | 
 |  |  |         and loc_no = #{locNo} | 
 |  |  |         and matnr = #{matnr} | 
 |  |  |         <choose> | 
 |  |  |             <when test="batch != null and batch != ''"> | 
 |  |  |                 and batch = #{batch} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (batch IS NULL OR batch = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |         <choose> | 
 |  |  |             <when test="csocode != null and csocode != ''"> | 
 |  |  |                 and three_code = #{csocode} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (three_code IS NULL OR three_code = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |         <choose> | 
 |  |  |             <when test="isocode != null and isocode != ''"> | 
 |  |  |                 and dead_time = #{isocode} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (dead_time IS NULL OR dead_time = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |         <choose> | 
 |  |  |             <when test="process != null and process != ''"> | 
 |  |  |                 and process_sts = #{process} | 
 |  |  |             </when> | 
 |  |  |             <otherwise> | 
 |  |  |                 and (process_sts IS NULL OR process_sts = '') | 
 |  |  |             </otherwise> | 
 |  |  |         </choose> | 
 |  |  |     </update> | 
 |  |  |  | 
 |  |  |     <delete id = "deleteLocDetl"> | 
 |  |  |         delete from agv_loc_detl | 
 |  |  |         where 1=1 |