| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.ParseException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private PlaService plaService; |
| | | @Autowired |
| | | private NodeService nodeService; |
| | | @Autowired |
| | | private OpenService openService; |
| | | |
| | | |
| | | // 商品上架 |
| | |
| | | |
| | | @RequestMapping("/plaDetl/packin/v1") |
| | | //@ManagerAuth(memo="pla入库") |
| | | public R plaPackIn(@RequestBody JSONObject json){ |
| | | @Transactional |
| | | 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(); |
| | | String batch = jsonObject.get("batch").toString(); |
| | | Integer packageNo = Integer.parseInt(jsonObject.get("packageNo").toString()); |
| | | if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | |
| | | if(true){ |
| | | User user = new User(); |
| | | user.setUsername("test"); |
| | | mobileService.plaPakin(locNo,batch,packageNo,user); |
| | | mobileService.plaPakin(brand,locNo,batch,packageNo,user); |
| | | } |
| | | } |
| | | //入库成功后上报ERP |
| | | //openService.pakinReportErp(json); |
| | | return R.ok("入库成功"); |
| | | } |
| | | |
| | | @RequestMapping("/plaDetl/packin/v11") |
| | | @ManagerAuth(memo="pla入库") |
| | | @Transactional |
| | | public R plaPackInTestErp(@RequestBody JSONObject json) throws ParseException { |
| | | String locNo = json.get("locNo").toString(); |
| | | JSONArray jsonArray = JSONArray.parseArray(json.getJSONArray("pla").toJSONString()); |
| | | for (Object o : jsonArray){ |
| | | JSONObject jsonObject = (JSONObject)o; |
| | | String brand = jsonObject.get("brand").toString(); |
| | | String batch = jsonObject.get("batch").toString(); |
| | | Integer packageNo = Integer.parseInt(jsonObject.get("packageNo").toString()); |
| | | if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | //测试 |
| | | 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 |
| | | openService.pakinReportErp(json); |
| | | return R.ok("入库成功"); |
| | | } |
| | | |
| | |
| | | // @ManagerAuth(memo="pla出库") |
| | | public R plaPackOut1(@RequestBody JSONObject json){ |
| | | String locNo = json.get("locNo").toString(); |
| | | String brand = json.get("brand").toString(); |
| | | String batch = json.get("batch").toString(); |
| | | Integer packageNo = Integer.parseInt(json.get("packageNo").toString()); |
| | | String orderNo = json.get("orderNo").toString(); |
| | | String orderDetlId = json.get("orderDetlId").toString(); |
| | | String wrkNo = json.get("wrkNo").toString(); |
| | | Double anfme = Double.parseDouble(json.get("anfme").toString()); |
| | | boolean isReplace = Cools.eq(json.get("replace").toString(),"y"); |
| | | |
| | | if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | |
| | | mobileService.plaPakout(locNo,batch,packageNo,orderNo,orderDetlId,wrkNo,anfme); |
| | | mobileService.plaPakout(brand,locNo,batch,packageNo,orderNo,orderDetlId,wrkNo,anfme,isReplace); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | // @ManagerAuth(memo="pla出库") |
| | | public R plaPackOut(@RequestBody JSONObject json){ |
| | | String locNo = json.get("locNo").toString(); |
| | | String brand = json.get("brand").toString(); |
| | | String batch = json.get("batch").toString(); |
| | | Integer packageNo = Integer.parseInt(json.get("packageNo").toString()); |
| | | String orderNo = json.get("orderNo").toString(); |
| | | String orderDetlId = json.get("orderDetlId").toString(); |
| | | String plaQtyId = json.get("orderDetlId").toString(); |
| | | String wrkNo = json.get("wrkNo").toString(); |
| | | Double anfme = Double.parseDouble(json.get("anfme").toString()); |
| | | boolean isReplace = !Cools.isEmpty(json.get("replace")) && Cools.eq(json.get("replace").toString(),"y"); |
| | | |
| | | if(Cools.isEmpty(locNo) || Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | |
| | | mobileService.plaPakout(locNo,batch,packageNo,orderNo,orderDetlId,wrkNo,anfme); |
| | | mobileService.plaPakout(brand,locNo,batch,packageNo,orderNo,plaQtyId,wrkNo,anfme,isReplace); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /* |
| | | 无订单拣货出库 |
| | | */ |
| | | @RequestMapping("/plaDetl/packout/noOrder/v1") |
| | | //@ManagerAuth(memo="pla手动出库") |
| | | public R plaPackOutWithoutOrder(@RequestBody List<PlaParam> params){ |
| | | |
| | | for (PlaParam param : params){ |
| | | mobileService.plaPackOutWithoutOrder(param.getBrand(),param.getBatch(),param.getPackageNo(),param.getAnfme()); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @RequestMapping("/plaDetl/check/v1") |
| | | public R plaDetlCheck(@RequestBody JSONObject json){ |
| | | String brand = json.get("brand").toString(); |
| | | String batch = json.get("batch").toString(); |
| | | Integer packageNo = Integer.parseInt(json.get("packageNo").toString()); |
| | | Integer type = Integer.parseInt(json.get("type").toString()); |
| | |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | |
| | | Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo); |
| | | 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); |
| | | } |
| | |
| | | */ |
| | | @RequestMapping("/plaDetl/move/v1") |
| | | @ManagerAuth |
| | | public R plaDetlMove(@RequestBody JSONObject json){ |
| | | public R plaDetlMove(@RequestBody PlaMoveParam param){ |
| | | |
| | | String batch = json.get("batch").toString(); |
| | | Integer packageNo = Integer.parseInt(json.get("packageNo").toString()); |
| | | String locNo = json.get("locNo").toString(); |
| | | |
| | | if(Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | return R.error("有参数为空,无法入库"); |
| | | } |
| | | |
| | | Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo); |
| | | if ((Cools.isEmpty(pla))){ |
| | | return R.error("该包物料未录入,无法查询到相关信息"); |
| | | } |
| | | if(!Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1)){ |
| | | return R.error("该包物料状态不为已入库状态,无法转移"); |
| | | } |
| | | String locNo = param.getLocNo(); |
| | | |
| | | Node node = nodeService.selectByUuid(locNo); |
| | | if(Cools.isEmpty(node)){ |
| | | throw new CoolException("库位信息不正确"); |
| | | } |
| | | |
| | | String sourceLocNo = pla.getLocNo(); |
| | | List<PlaMoveParam.PlaMove> plas = param.getPlas(); |
| | | //判断此次入库是否达到库存上限 |
| | | if(!mobileService.checkMaximum(locNo,plas.size())){ |
| | | return R.error("当前入库包数已超过库存上限"); |
| | | } |
| | | |
| | | pla.setLocNo(locNo); |
| | | pla.setStash(node.getParentName()); |
| | | pla.setModifyTime(new Date()); |
| | | param.getPlas().forEach(p -> { |
| | | String brand = p.getBrand(); |
| | | String batch = p.getBatch(); |
| | | Integer packageNo = p.getPackageNo(); |
| | | if(Cools.isEmpty(batch) || Cools.isEmpty(packageNo)){ |
| | | throw new CoolException("有参数为空,无法入库"); |
| | | } |
| | | Pla pla = plaService.selectByBatchAndPackageNo(batch, packageNo,brand); |
| | | if ((Cools.isEmpty(pla))){ |
| | | throw new CoolException("该包物料未录入,无法查询到相关信息"); |
| | | } |
| | | if(!Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1) && !Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_3)){ |
| | | throw new CoolException("该包物料的状态为" + pla.getStatus() +",无法进行入库操作"); |
| | | } |
| | | |
| | | plaService.updateById(pla); |
| | | String sourceLocNo = pla.getLocNo(); |
| | | pla.setLocNo(locNo); |
| | | pla.setStash(node.getParentName()); |
| | | pla.setModifyTime(new Date()); |
| | | |
| | | SaasUtils.insertLog(2,sourceLocNo,pla.getBrand(),pla.getWeightAnfme(),getUser().getUsername(), |
| | | locNo,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop()); |
| | | plaService.updateById(pla); |
| | | SaasUtils.insertLog(2,sourceLocNo,pla.getBrand(),pla.getWeightAnfme(),getUser().getUsername(), |
| | | locNo,pla.getBatch(),pla.getPackageNo(),pla.getOwner(),pla.getWorkshop(),null); |
| | | |
| | | return R.ok(); |
| | | }); |
| | | |
| | | return R.ok("移库成功"); |
| | | } |
| | | |
| | | /* |
| | |
| | | |
| | | return R.ok(); |
| | | } |
| | | @RequestMapping("select/mat/information/v1") |
| | | @ManagerAuth |
| | | public R pdaSelectInformation(@RequestParam String barcode){ |
| | | List<Pla> locDetls = mobileService.pdaSelectInfmt(barcode); |
| | | return R.ok(locDetls); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |