| | |
| | | public R plaPackIn(@RequestBody JSONObject json) throws ParseException { |
| | | String locNo = json.get("locNo").toString(); |
| | | JSONArray jsonArray = JSONArray.parseArray(json.getJSONArray("pla").toJSONString()); |
| | | //判断此次入库是否达到库存上限 |
| | | if(!mobileService.checkMaximum(locNo,jsonArray.size())){ |
| | | return R.error("当前入库包数已超过库存上限"); |
| | | } |
| | | for (Object o : jsonArray){ |
| | | JSONObject jsonObject = (JSONObject)o; |
| | | String brand = jsonObject.get("brand").toString(); |
| | |
| | | return R.ok("入库成功"); |
| | | } |
| | | |
| | | @RequestMapping("/plaDetl/packin/v2") |
| | | //@ManagerAuth(memo="pla入库") |
| | | @RequestMapping("/plaDetl/packin/v11") |
| | | @ManagerAuth(memo="pla入库") |
| | | @Transactional |
| | | public R plaPackInTestErp(@RequestBody JSONObject json) throws ParseException { |
| | | String locNo = json.get("locNo").toString(); |
| | |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | //测试 |
| | | if(true){ |
| | | if(false){ |
| | | User user = new User(); |
| | | user.setUsername("test"); |
| | | mobileService.plaPakin(brand,locNo,batch,packageNo,user); |
| | | json.put("user",user.getUsername()); |
| | | }else { |
| | | mobileService.plaPakin(brand,locNo,batch,packageNo,getUser()); |
| | | json.put("user",getUser().getUsername()); |
| | | } |
| | | } |
| | | //入库成功后上报ERP |
| | |
| | | |
| | | Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo,brand); |
| | | if ((Cools.isEmpty(pla))){ |
| | | return R.error("该包物料未录入,无法查询到相关信息"); |
| | | return R.error("该包物料未录入,无法查询到相关信息").add(pla); |
| | | } |
| | | if(!(Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_0) || Cools.eq(pla.getStatus(), GlobleParameter.PLA_STATUS_00)) && type != 2){ |
| | | return R.error("该包物料不为待入库状态,无法进行入库操作"); |
| | | return R.error("该包物料的状态为" + pla.getStatus() +",无法进行入库操作").add(pla); |
| | | } |
| | | return R.ok(pla); |
| | | } |
| | |
| | | } |
| | | |
| | | List<PlaMoveParam.PlaMove> plas = param.getPlas(); |
| | | //判断此次入库是否达到库存上限 |
| | | if(!mobileService.checkMaximum(locNo,plas.size())){ |
| | | return R.error("当前入库包数已超过库存上限"); |
| | | } |
| | | |
| | | param.getPlas().forEach(p -> { |
| | | String brand = p.getBrand(); |
| | |
| | | throw new CoolException("该包物料未录入,无法查询到相关信息"); |
| | | } |
| | | if(!Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1) && !Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_3)){ |
| | | throw new CoolException("该包物料状态不为入库状态,无法转移"); |
| | | throw new CoolException("该包物料的状态为" + pla.getStatus() +",无法进行入库操作"); |
| | | } |
| | | |
| | | String sourceLocNo = pla.getLocNo(); |
| | |
| | | |
| | | plaService.updateById(pla); |
| | | SaasUtils.insertLog(2,sourceLocNo,pla.getBrand(),pla.getWeightAnfme(),getUser().getUsername(), |
| | | locNo,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop()); |
| | | locNo,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop(),null); |
| | | |
| | | }); |
| | | |