| | |
| | | |
| | | import com.zy.asrs.entity.BasAgvLocDetl; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface BasAgvLocDetlMapper extends BaseMapper<BasAgvLocDetl> { |
| | | @Update("update asr_bas_agv_loc_detl set loc_no = #{newLocNo}, modi_time=getDate() where loc_no = #{oldLocNo}") |
| | | int updateLocNo(String newLocNo, String oldLocNo); |
| | | |
| | | BasAgvLocDetl selectItem(@Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch, |
| | | @Param("brand")String brand, @Param("standby1")String standby1, @Param("standby2")String standby2, |
| | | @Param("standby3")String standby3, @Param("boxType1")String boxType1, @Param("boxType2")String boxType2, @Param("boxType3")String boxType3 ); |
| | | int updateAnfme(@Param("anfme")Double anfme, @Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch, |
| | | @Param("brand")String brand,@Param("standby1")String standby1,@Param("standby2")String standby2, |
| | | @Param("standby3")String standby3,@Param("boxType1")String boxType1,@Param("boxType2")String boxType2,@Param("boxType3")String boxType3 ); |
| | | int deleteItem(@Param("locNo")String locNo, @Param("matnr")String matnr, @Param("batch")String batch, |
| | | @Param("brand")String brand,@Param("standby1")String standby1,@Param("standby2")String standby2, |
| | | @Param("standby3")String standby3,@Param("boxType1")String boxType1,@Param("boxType2")String boxType2,@Param("boxType3")String boxType3 ); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.zy.asrs.entity.BasAgvLocDetl; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.LocDetl; |
| | | |
| | | public interface BasAgvLocDetlService extends IService<BasAgvLocDetl> { |
| | | boolean updateLocNo(String newLocNo, String oldLocNo); |
| | | BasAgvLocDetl selectItem(String locNo, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3); |
| | | boolean updateAnfme(Double anfme, String locNo, String matnr |
| | | ,String batch,String brand,String standby1,String standby2,String standby3,String boxType1,String boxType2,String boxType3); |
| | | |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.zy.asrs.entity.LocDetl; |
| | | import com.zy.asrs.mapper.BasAgvLocDetlMapper; |
| | | import com.zy.asrs.entity.BasAgvLocDetl; |
| | | import com.zy.asrs.service.BasAgvLocDetlService; |
| | |
| | | |
| | | @Service("basAgvLocDetlService") |
| | | public class BasAgvLocDetlServiceImpl extends ServiceImpl<BasAgvLocDetlMapper, BasAgvLocDetl> implements BasAgvLocDetlService { |
| | | @Override |
| | | public boolean updateLocNo(String newLocNo, String oldLocNo) { |
| | | return baseMapper.updateLocNo(newLocNo, oldLocNo) > 0; |
| | | } |
| | | @Override |
| | | public BasAgvLocDetl selectItem(String locNo, String matnr, String batch, String brand, String standby1, String standby2, String standby3, String boxType1, String boxType2, String boxType3) { |
| | | return this.baseMapper.selectItem(locNo, matnr, batch,brand,standby1,standby2,standby3,boxType1,boxType2,boxType3); |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateAnfme(Double anfme, String locNo, String matnr, String batch, |
| | | String brand,String standby1,String standby2,String standby3,String boxType1,String boxType2,String boxType3) { |
| | | if (anfme <= 0) { |
| | | return this.baseMapper.deleteItem(locNo, matnr, batch, brand, standby1, standby2, standby3, boxType1, boxType2, boxType3) > 0; |
| | | } else { |
| | | return baseMapper.updateAnfme(anfme, locNo, matnr, batch, brand, standby1, standby2, standby3, boxType1, boxType2, boxType3) > 0; |
| | | } |
| | | } |
| | | } |
| | |
| | | case 1: |
| | | LocMast sourceLoc1 = locMastService.selectById(basAgvMast.getSourceLocNo()); |
| | | LocMast locMast1 = locMastService.selectById(basAgvMast.getLocNo()); |
| | | List<LocDetl> locDetls1 = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | List<BasAgvLocDetl> locDetls1 = basAgvLocDetlService.selectList(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | if (!locDetls1.isEmpty()) { |
| | | locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | basAgvLocDetlService.delete(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | } |
| | | // 修改目标库位状态 ==> .locSts |
| | | locMast1.setLocSts("F"); |
| | |
| | | } |
| | | try{ |
| | | // 转移库存明细数据: 库存号 由工作档源库位变为目标库位 |
| | | locDetlService.updateLocNo(basAgvMast.getLocNo(), basAgvMast.getSourceLocNo()); |
| | | basAgvLocDetlService.updateLocNo(basAgvMast.getLocNo(), basAgvMast.getSourceLocNo()); |
| | | } catch (Exception e) { |
| | | return FAIL.setMsg(e.getMessage()); |
| | | } |
| | |
| | | |
| | | basAgvLocDetlService.delete(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getSourceLocNo())); |
| | | basAgvWrkDetlService.delete(new EntityWrapper<BasAgvWrkDetl>().eq("wrk_no", basAgvMast.getTaskNo())); |
| | | basAgvLocDetlService.delete(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | // basAgvLocDetlService.delete(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | basAgvMast.setStatus(4); |
| | | basAgvMastService.updateById(basAgvMast); |
| | | // openService.agvBindAndBin(String.valueOf(basAgvMast.getTaskNo())); |
| | | break; |
| | | case 2: |
| | | List<LocDetl> locDetls2 = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | List<BasAgvLocDetl> locDetls2 = basAgvLocDetlService.selectList(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | if (!locDetls2.isEmpty()) { |
| | | locDetlService.delete(new EntityWrapper<LocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | basAgvLocDetlService.delete(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | } |
| | | |
| | | LocMast locMast2 = locMastService.selectById(basAgvMast.getLocNo()); |
| | |
| | | return FAIL.setMsg("库位状态异常"); |
| | | } |
| | | List<LocDetl> locDetlList1 = new ArrayList<>(); |
| | | List<LocDetl> locDetlList2 = new ArrayList<>(); |
| | | List<BasAgvLocDetl> basAgvLocDetlList = basAgvLocDetlService.selectList(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getSourceLocNo())); |
| | | List<BasAgvLocDetl> locDetlList2 = new ArrayList<>(); |
| | | List<BasAgvWrkDetl> basAgvWrkDetlList = basAgvWrkDetlService.selectList(new EntityWrapper<BasAgvWrkDetl>().eq("wrk_no", basAgvMast.getTaskNo())); |
| | | if (!basAgvLocDetlList.isEmpty()) { |
| | | for (BasAgvLocDetl basAgvLocDetl : basAgvLocDetlList){ |
| | | LocDetl locDetl = new LocDetl(); |
| | | locDetl.sync(basAgvLocDetl); |
| | | locDetlList1.add(locDetl); |
| | | } |
| | | } else if (!basAgvWrkDetlList.isEmpty()){ |
| | | if (!basAgvWrkDetlList.isEmpty()){ |
| | | for (BasAgvWrkDetl wrkDetl : basAgvWrkDetlList){ |
| | | LocDetl locDetl = new LocDetl(); |
| | | BasAgvLocDetl locDetl = new BasAgvLocDetl(); |
| | | locDetl.sync(wrkDetl); |
| | | locDetl.setLocNo(basAgvMast.getLocNo()); // 库位号 |
| | | locDetl.setAnfme(wrkDetl.getAnfme()); // 数量 |
| | |
| | | } else { |
| | | locMast2.setLocSts("D"); |
| | | } |
| | | |
| | | if (!locMastService.updateById(locMast2)) { |
| | | return FAIL; |
| | | } |
| | | if (!locDetlList1.isEmpty()){ |
| | | for (LocDetl locDetlold : locDetlList1) { |
| | | LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand() |
| | | ,locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3(),locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3()); |
| | | if (null != locDetl) { |
| | | if (!locDetlService.updateAnfme(locDetlold.getAnfme(), basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand(),locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3() |
| | | ,locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3())) { |
| | | } |
| | | } else { |
| | | if (!locDetlService.insert(locDetlold)) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!locDetlList2.isEmpty()){ |
| | | for (LocDetl locDetlold : locDetlList2) { |
| | | LocDetl locDetl = locDetlService.selectItem(basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand() |
| | | for (BasAgvLocDetl locDetlold : locDetlList2) { |
| | | BasAgvLocDetl locDetl = basAgvLocDetlService.selectItem(basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand() |
| | | ,locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3(),locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3()); |
| | | if (null != locDetl) { |
| | | if (!locDetlService.updateAnfme(locDetlold.getAnfme(), basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand(),locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3() |
| | | if (!basAgvLocDetlService.updateAnfme(locDetlold.getAnfme(), basAgvMast.getLocNo(), locDetlold.getMatnr(), locDetlold.getBatch(),locDetlold.getBrand(),locDetlold.getStandby1(),locDetlold.getStandby2(),locDetlold.getStandby3() |
| | | ,locDetlold.getBoxType1(),locDetlold.getBoxType2(),locDetlold.getBoxType3())) { |
| | | } |
| | | } else { |
| | | if (!locDetlService.insert(locDetlold)) { |
| | | if (!basAgvLocDetlService.insert(locDetlold)) { |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | basAgvLocDetlService.delete(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | // basAgvLocDetlService.delete(new EntityWrapper<BasAgvLocDetl>().eq("loc_no", basAgvMast.getLocNo())); |
| | | basAgvWrkDetlService.delete(new EntityWrapper<BasAgvWrkDetl>().eq("wrk_no", basAgvMast.getTaskNo())); |
| | | basAgvMast.setStatus(3); |
| | | if(basAgvMast.getFloorNo() == 2 || basAgvMast.getFloorNo() == 3){ |
| | |
| | | @Value("${erp.switch.ReviewOrderSwitch}") |
| | | private boolean ReviewOrderSwitch; |
| | | |
| | | // @Scheduled(cron = "0/20 * * * * ? ") |
| | | @Scheduled(cron = "0/20 * * * * ? ") |
| | | @Async("orderThreadPool") |
| | | public void completeAndReport(){ |
| | | if(!ReviewOrderSwitch){ |
| | |
| | | "物料档案不存在:" + matnr, false); |
| | | continue; |
| | | } |
| | | if (mat.getSafeQty() == null || mat.getSafeQty() == 0) { |
| | | callApiLogSaveOrder(order, kingDeeUtilType, |
| | | "档案箱数量异常:" + matnr, false); |
| | | continue; |
| | | } |
| | | anfmeBox = Math.floor(anfme / mat.getSafeQty()); |
| | | // ========= 明细去重 ========= |
| | | List<OrderDetl> orderDetls = |
| | |
| | | String owner = "和得科技"; |
| | | String ownerUuid = "BU-00001"; |
| | | String orderId = jsonObjectNew.getString("id"); |
| | | String manuBill = jsonObjectNew.getString("manufacturenun"); |
| | | // ========= 货主校验 ========= |
| | | LocOwner locOwner = locOwnerService.selectByUuid(ownerUuid); |
| | | // if (locOwner == null) { |
| | |
| | | null, // 项目编号 |
| | | orderId, //收料单id |
| | | null, // 调拨项目编号 |
| | | null, // 初始票据号 |
| | | manuBill, // 初始票据号 |
| | | null, // 票据号 |
| | | null, // 项目id |
| | | owner, // 货主 |
| | |
| | | JSONObject billentry = new JSONObject() |
| | | .fluentPut("id", 0L) |
| | | .fluentPut("warehouse_number", orderDetl.getManu()) // 仓库编号 |
| | | .fluentPut("invstatus_number", "110") // 库存状态 |
| | | .fluentPut("invtype_number", "110") // 库存类型 |
| | | .fluentPut("outinvstatus_number", "110") |
| | | .fluentPut("linetype_number", "010") // 行号类型 |
| | | .fluentPut("qty", qty) // 数量 |
| | | .fluentPut("material_number", orderDetl.getMatnr()) // 物料编号 |
| | | .fluentPut("baseqty", qty) // 数量 |
| | | .fluentPut("prdqty", qty) // 数量 |
| | | .fluentPut("manubill", order.getDefNumber()) |
| | | .fluentPut("producttype", "C") // 物料编号 |
| | | .fluentPut("qualitystatus", "A") // 物料编号 |
| | | .fluentPut("billentry_lk", billentryLkArray1); |
| | | |
| | | billentryArray1.add(billentry); |
| | |
| | | new JSONObject() |
| | | .fluentPut("billno", UUID.randomUUID().toString().replace("-", "").substring(0, 16)) |
| | | .fluentPut("trdbillno", UUID.randomUUID().toString().replace("-", "")) |
| | | .fluentPut("billtype_number", "im_PurInBill_STD_BT_S") |
| | | .fluentPut("billstatus", "C") |
| | | .fluentPut("biztime", sdf1.format(now1)) |
| | | .fluentPut("exratedate", sdf1.format(now1)) |
| | | .fluentPut("bizorg_number", boxType21) |
| | | .fluentPut("biztype_number", "110") // 货主/货源 |
| | | .fluentPut("org_number", boxType21) // 货主/货源 |
| | | .fluentPut("paymode", "CREDIT") |
| | | .fluentPut("invscheme_number", "110") |
| | | .fluentPut("billtype_number", "im_PurInBill_STD_BT_S") |
| | | .fluentPut("supplier_number", suppCode1) // 供应商编号 |
| | | .fluentPut("billentry", billentryArray1) // 将 billentry 数组添加到请求参数 |
| | | ))); |
| | | case "STK_MISCELLANEOUS": // 其他入库单 |
| | |
| | | and a.standby3 like '%' + #{standby3} + '%' |
| | | </if> |
| | | <if test="boxType3!=null and boxType3!='' "> |
| | | and a.box_type3 like '%' + #{boxType3} + '%' |
| | | and a.boxType3 like '%' + #{boxType3} + '%' |
| | | </if> |
| | | </sql> |
| | | |