|
@@ -253,6 +253,77 @@ public class WmsInboundResultController extends BaseRESTfulController {
|
|
|
return success(pageList);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增入库实绩
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("新增入库实绩")
|
|
|
+ @PostMapping("/insertInboundResult4")
|
|
|
+ @Transactional
|
|
|
+ public RESTfulResult addInvoice2(@RequestParam("userName") String userName,@RequestParam("groupId") BigDecimal groupId,@RequestParam("personnelWorkshopid") BigDecimal personnelWorkshopid, @RequestBody(required = false) List<Map<String, Object>> mapList) {
|
|
|
+
|
|
|
+ //遗留 查询批次、以及状态
|
|
|
+ int batch=0;
|
|
|
+ //需要判断是否已经提交过了 通过resultId判断物质是否已经下发过了跳出、多次下发的结果
|
|
|
+ int resultStatus= wmsInboundScanResultServiceImpl.getResultStatusByResultId(mapList.get(0).get("resultId").toString());
|
|
|
+ if(resultStatus==1){
|
|
|
+ return success("请勿重复下发");
|
|
|
+ }
|
|
|
+ //、创建批次
|
|
|
+ WmspInboundDistribute wmspInboundDistribute=wmspInboundDistributeService.initAndCreateInboundDistribute(personnelWorkshopid,groupId,userName,batch);
|
|
|
+ //判断物质是否是线材
|
|
|
+
|
|
|
+
|
|
|
+ //将下面的订单都录入这个批次里面
|
|
|
+ for (int i=0;i<mapList.size();i++){
|
|
|
+ BigDecimal count = wmsInboundScanResultService.selectMaterialTypeByMaterialId(new BigDecimal(mapList.get(0).get("materialId").toString()));
|
|
|
+ if (count!=null){
|
|
|
+ Map<String,Object> item=mapList.get(i);
|
|
|
+ // BigDecimal houseGrid = rmsPwarehouseGridService.selectGrid(mapList.size()-(i+1), personnelWorkshopid,new BigDecimal(item.get("materialId").toString()));
|
|
|
+ BigDecimal houseGrid = null;
|
|
|
+ if (personnelWorkshopid.compareTo(new BigDecimal(1))==0){
|
|
|
+ houseGrid = new BigDecimal("12335");
|
|
|
+ }else if (personnelWorkshopid.compareTo(new BigDecimal(2))==0){
|
|
|
+ houseGrid = new BigDecimal("24472");
|
|
|
+ }
|
|
|
+ //创建一个入库作业实绩
|
|
|
+ WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(1,i+1,personnelWorkshopid,groupId,userName,wmspInboundDistribute.getDistributeId(),houseGrid,item);
|
|
|
+ //改变扫码实绩里面的状态
|
|
|
+ int status= wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()),wmspInboundResult.getInboundId());
|
|
|
+ //创建实时库存
|
|
|
+ wmspGridMaterialService.initInsertWmspGridMaterial(item,houseGrid);
|
|
|
+ //改为扫一次添加得代码
|
|
|
+ //当都完成的时候就要去改变这一批的状态改为下发状态
|
|
|
+ if(mapList.size()==i+1){
|
|
|
+ int status2= wmsInboundResultServiceImpl.updateInboundStatus(wmspInboundDistribute.getDistributeId());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //如果是线材直接结束
|
|
|
+ //将下面的订单都录入这个批次里面
|
|
|
+ Map<String, Object> item = mapList.get(i);
|
|
|
+ //获得高线库
|
|
|
+ HashMap<String, Object> map3 = new HashMap<>();
|
|
|
+ map3.put("warehouseId",3);
|
|
|
+ BigDecimal houseGrid=rmsPwarehouseGridService.getGridId(map3);;
|
|
|
+ //创建一个入库作业实绩
|
|
|
+ WmspInboundResult wmspInboundResult = wmsInboundResultServiceImpl.initAndWmspInboundResult(1, i + 1, personnelWorkshopid, new BigDecimal(0), userName, wmspInboundDistribute.getDistributeId(), houseGrid, item);
|
|
|
+ //改变扫码实绩里面的状态
|
|
|
+ int status = wmsInboundScanResultServiceImpl.updateInboundScanStatus(new BigDecimal(item.get("resultId").toString()), wmspInboundResult.getInboundId());
|
|
|
+ //创建实时库存
|
|
|
+ wmspGridMaterialService.initInsertWmspGridMaterial(item, houseGrid);
|
|
|
+ //当都完成的时候就要去改变这一批的状态改为下发状态
|
|
|
+ if(mapList.size()==i+1){
|
|
|
+ int status2= wmsInboundResultServiceImpl.updateInboundStatus(wmspInboundDistribute.getDistributeId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //改为扫一次添加得代码
|
|
|
+ int status3= wmspInboundDistributeService.updateDistributeStatus(wmspInboundDistribute.getDistributeId().toString());
|
|
|
+ }
|
|
|
+ return success("下发成功");
|
|
|
+ }
|
|
|
/**
|
|
|
* 新增入库实绩
|
|
|
*
|