| | |
| | | import com.core.exception.CoolException; |
| | | import com.sun.org.apache.xpath.internal.operations.Or; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.CombParam; |
| | | import com.zy.asrs.entity.param.MobileAdjustParam; |
| | | import com.zy.asrs.entity.param.OffSaleParam; |
| | | import com.zy.asrs.entity.param.OpenOrderPakinParam; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.mapper.ManLocDetlMapper; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.MatUtils; |
| | |
| | | private ManLocDetlMapper manLocDetlMapper; |
| | | @Autowired |
| | | private WaitPakinLogService waitPakinLogService; |
| | | |
| | | @Autowired |
| | | private LocCheckService locCheckService; |
| | | |
| | | @Autowired |
| | | private OrderCheckService orderCheckService; |
| | | |
| | | |
| | | |
| | |
| | | throw new CoolException("修改单据作业数量失败"); |
| | | } |
| | | |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),orderDetl.getOwner(),elem.getWeight()); |
| | | detlDto.setPayment(orderDetl.getPayment()); |
| | | DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getAnfme(),elem.getWeight()); |
| | | if (DetlDto.has(detlDtos, detlDto)) { |
| | | DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch()); |
| | | assert one != null; |
| | |
| | | Date date = new Date(); |
| | | String jsonLocNo = (String) json.get("locNo"); |
| | | |
| | | LocMast locMast = locMastService.selectLocStatus(jsonLocNo); |
| | | if (locMast.getLocSts().equals("X")){ |
| | | return R.error("库位已被冻结"); |
| | | } |
| | | |
| | | List<ManLocDetl> locDetls = manLocDetlService.selectList(new EntityWrapper<ManLocDetl>().eq("loc_no", jsonLocNo)); |
| | | Node node = nodeService.selectOne(new EntityWrapper<Node>() |
| | | .eq("name", jsonLocNo)); |
| | | |
| | | if (node.getParentName().equals("A") || node.getParentName().equals("B")){ |
| | | if (node.getRow1() == 1 && locDetls.size() >=11){ |
| | | return R.error("该库位排已满"); |
| | | } |
| | | if (node.getRow1() == 6 && locDetls.size() >=4){ |
| | | return R.error("该库位排已满"); |
| | | } |
| | | if (node.getRow1() == 12 && locDetls.size() >=4){ |
| | | return R.error("该库位排已满"); |
| | | } |
| | | |
| | | } |
| | | if (locDetls.size() >=12){ |
| | | return R.error("该库位排已满"); |
| | | } |
| | | // if (node.getParentName().equals("A") || node.getParentName().equals("B")){ |
| | | // if (node.getRow1() == 1 && locDetls.size() >=11){ |
| | | // return R.error("该库位排已满"); |
| | | // } |
| | | // if (node.getRow1() == 6 && locDetls.size() >=4){ |
| | | // return R.error("该库位排已满"); |
| | | // } |
| | | // if (node.getRow1() == 12 && locDetls.size() >=4){ |
| | | // return R.error("该库位排已满"); |
| | | // } |
| | | // |
| | | // } |
| | | // if (locDetls.size() >=12){ |
| | | // return R.error("该库位排已满"); |
| | | // } |
| | | |
| | | |
| | | |
| | |
| | | return R.error("入库数量大于可入数量"); |
| | | } |
| | | //查询平库中是否有一样的物料号,有的话直接增加数量 |
| | | // ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch()); |
| | | // if (checkManLocDetl == null) { |
| | | ManLocDetl checkManLocDetl = manLocDetlService.selectInventory(jsonLocNo,orderDetl.getMatnr(),jsonOrderDetl.getBatch()); |
| | | if (checkManLocDetl == null) { |
| | | |
| | | ManLocDetl manLocDetl = new ManLocDetl(); |
| | | Synchro.Copy(orderDetl, manLocDetl); |
| | |
| | | manLocDetl.setOwner(orderDetl.getOwner()); |
| | | manLocDetl.setWeight(jsonOrderDetl.getWeight()); |
| | | manLocDetl.setOrderNo(jsonOrderDetl.getOrderNo()); |
| | | manLocDetl.setStockFreeze(1); |
| | | if(!manLocDetlService.insert(manLocDetl)){ |
| | | return R.error("插入平库物料失败!"); |
| | | } |
| | | // } |
| | | // else { |
| | | // if (checkManLocDetl.getWeight() == null){ |
| | | // checkManLocDetl.setWeight(0.0); |
| | | // } |
| | | // if (jsonOrderDetl.getWeight() == null){ |
| | | // jsonOrderDetl.setWeight(0.0); |
| | | // } |
| | | // if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(), |
| | | // node.getName(), |
| | | // jsonOrderDetl.getMatnr(), |
| | | // jsonOrderDetl.getBatch(),checkManLocDetl.getWeight()+jsonOrderDetl.getWeight() |
| | | // )<=0 |
| | | // ){ |
| | | // return R.error("修改平库物料失败!"); |
| | | // } |
| | | // |
| | | // } |
| | | } |
| | | else { |
| | | if (checkManLocDetl.getWeight() == null){ |
| | | checkManLocDetl.setWeight(0.0); |
| | | } |
| | | if (jsonOrderDetl.getWeight() == null){ |
| | | jsonOrderDetl.setWeight(0.0); |
| | | } |
| | | if(manLocDetlService.increase(checkManLocDetl.getAnfme() + jsonOrderDetl.getAnfme(), |
| | | node.getName(), |
| | | jsonOrderDetl.getMatnr(), |
| | | jsonOrderDetl.getBatch(),checkManLocDetl.getWeight()+jsonOrderDetl.getWeight() |
| | | )<=0 |
| | | ){ |
| | | return R.error("修改平库物料失败!"); |
| | | } |
| | | |
| | | } |
| | | orderDetl.setQty(orderDetl.getQty() + jsonOrderDetl.getAnfme()); |
| | | orderDetl.setWorkQty(orderDetl.getWorkQty() + jsonOrderDetl.getAnfme()); |
| | | orderDetl.setUpdateTime(date); |
| | |
| | | public R manDetlOut(JSONObject json,User user) { |
| | | Date date = new Date(); |
| | | String jsonLocNo = (String) json.get("locNo"); |
| | | |
| | | LocMast locMast = locMastService.selectLocStatus(jsonLocNo); |
| | | if (locMast.getLocSts().equals("X")){ |
| | | return R.error("库位已被冻结"); |
| | | } |
| | | |
| | | Node node = nodeService.selectOne(new EntityWrapper<Node>() |
| | | .eq("name", jsonLocNo)); |
| | | JSONArray combMats = json.getJSONArray("combMats"); |
| | |
| | | String jsonLocNo = (String) json.get("locNo"); //获取库位码 |
| | | String jsonBarNo = (String) json.get("barcode"); //获取托盘码 |
| | | |
| | | LocMast locMast = locMastService.selectLocStatus(jsonLocNo); |
| | | if (locMast.getLocSts().equals("X")){ |
| | | return R.error("库位已被冻结"); |
| | | } |
| | | |
| | | List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", jsonBarNo)); //获取对应组托信息 |
| | | if (Cools.isEmpty(waitPakins)){ |
| | | return R.error("未查询到组托"); |
| | |
| | | manLocDetl.setUpdateBy(user.getId()); |
| | | manLocDetl.setModiTime(date); |
| | | manLocDetl.setOrderNo(waitPakin.getOrderNo()); |
| | | manLocDetl.setOwner(waitPakin.getOwner()); |
| | | manLocDetl.setPayment(waitPakin.getPayment()); |
| | | manLocDetl.setStockFreeze(1); |
| | | |
| | | if (!manLocDetlService.insert(manLocDetl)){ //数据库插入实体类信息 |
| | | return R.error("物料信息入库失败"); |
| | |
| | | waitPakinLog.setModiTime(date); |
| | | waitPakinLog.setAppeUser(user.getId()); |
| | | waitPakinLog.setAppeTime(date); |
| | | waitPakinLog.setOwner(waitPakin.getOwner()); |
| | | waitPakinLog.setPayment(waitPakin.getPayment()); |
| | | waitPakinLog.setUuid(waitPakin.getUuid()); |
| | | |
| | | if (!waitPakinLogService.insert(waitPakinLog)){ //插入入库通知历史档数据库 |
| | |
| | | } |
| | | return R.ok("上架成功"); |
| | | } |
| | | |
| | | @Override |
| | | public R adjustNew(MobileAdjustNewParam combParam, Long userId) { |
| | | |
| | | |
| | | for (WrkDetl detl: combParam.getWrkDetls()){ |
| | | EntityWrapper<LocCheck> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("order_no", combParam.getOrderNo()) |
| | | .eq("matnr", detl.getMatnr()) |
| | | .eq("loc_no", detl.getLocNo()); |
| | | LocCheck CheckDetl = locCheckService.selectOne(wrapper); |
| | | if (CheckDetl == null){ |
| | | Date now = new Date(); |
| | | LocCheck locCheck = new LocCheck(); |
| | | locCheck.setLocNo(detl.getLocNo()); |
| | | locCheck.setMaktx(detl.getMaktx()); |
| | | locCheck.setType(1); |
| | | locCheck.setMatnr(detl.getMatnr()); |
| | | locCheck.setAnfme(detl.getAnfme()); |
| | | locCheck.setRealAnfme(detl.getAnfme()); |
| | | locCheck.setDiffAnfme(detl.getAnfme()); |
| | | locCheck.setExamine(0); |
| | | locCheck.setOwner(detl.getOwner()); |
| | | locCheck.setPayment(detl.getPayment()); |
| | | locCheck.setCreateTime(now); |
| | | locCheck.setUpdateTime(now); |
| | | locCheck.setOrderNo(combParam.getOrderNo()); |
| | | locCheck.setBatch(detl.getBatch()); |
| | | |
| | | if (!locCheckService.insert(locCheck)){ |
| | | return R.error("盘点明细插入失败"); |
| | | } |
| | | }else { |
| | | CheckDetl.setRealAnfme(detl.getAnfme()); |
| | | CheckDetl.setDiffAnfme(detl.getAnfme()- CheckDetl.getAnfme()); |
| | | if (!locCheckService.update(CheckDetl,wrapper)){ |
| | | return R.error("明细更新失败"); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | OrderCheck orderCheck = orderCheckService.selectOne(new EntityWrapper<OrderCheck>().eq("order_no", combParam.getOrderNo())); |
| | | orderCheck.setSettle(2L); |
| | | if (!orderCheckService.update(orderCheck,new EntityWrapper<OrderCheck>().eq("order_no", combParam.getOrderNo()))){ |
| | | return R.error("更新盘点单状态失败!"); |
| | | } |
| | | |
| | | |
| | | return R.ok("盘点成功"); |
| | | } |
| | | } |