|
@@ -78,7 +78,7 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
BigDecimal theoryWeight = DataChange.dataToBigDecimal(map.get("theoryWeight"));
|
|
BigDecimal theoryWeight = DataChange.dataToBigDecimal(map.get("theoryWeight"));
|
|
BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
|
|
BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
|
|
- BigDecimal singleWeight = theoryWeight.divide(materialNumber);
|
|
|
|
|
|
+ BigDecimal singleWeight = theoryWeight.divide(materialNumber,4,BigDecimal.ROUND_HALF_UP);
|
|
BigDecimal meter = DataChange.dataToBigDecimal(map.get("meter"));
|
|
BigDecimal meter = DataChange.dataToBigDecimal(map.get("meter"));
|
|
oyeInboundResult.setResultId(oyeInboundResultMapper.getResultId());
|
|
oyeInboundResult.setResultId(oyeInboundResultMapper.getResultId());
|
|
oyeInboundResult.setSaleArea(map.get("saleArea").toString());
|
|
oyeInboundResult.setSaleArea(map.get("saleArea").toString());
|
|
@@ -117,8 +117,23 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
OyeRealtimeInventory oyeRealtimeInventory = updateRealTimeInventory(map);
|
|
OyeRealtimeInventory oyeRealtimeInventory = updateRealTimeInventory(map);
|
|
oyeRealtimeInventoriesUpdate.add(oyeRealtimeInventory);
|
|
oyeRealtimeInventoriesUpdate.add(oyeRealtimeInventory);
|
|
}
|
|
}
|
|
- // 修改运单状态
|
|
|
|
|
|
+ if (!map.get("place").equals(map.get("inboundWarehouse"))) {
|
|
|
|
+ //如果收货地址与place,则需要修改收货地址
|
|
|
|
+ BigDecimal newPlaceId = oyeInboundResultMapper.getPlaceId(map.get("inboundWarehouse").toString());
|
|
|
|
+ //修改收货地址
|
|
|
|
+ Map<String, Object> addressMap = new HashMap<>();
|
|
|
|
+ addressMap.put("newPlaceId",newPlaceId);
|
|
|
|
+ addressMap.put("placeId",DataChange.dataToBigDecimal(map.get("placeId")));
|
|
|
|
+ addressMap.put("saleMaterialId",DataChange.dataToBigDecimal(map.get("saleMaterialId")));
|
|
|
|
+ oyeInboundResultMapper.updateAddressPlace(addressMap);
|
|
|
|
+ }
|
|
|
|
+ //判断该运单有没有签收实绩
|
|
|
|
+ String receiptAddress = oyeInboundResultMapper.selectReceiptResultId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
|
+ if(receiptAddress != null) {
|
|
|
|
+ oyeInboundResultMapper.updateOOOrderStatus(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
|
+ }
|
|
oyeInboundResultMapper.updateOrderStatus(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
oyeInboundResultMapper.updateOrderStatus(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
|
+ // 修改运单状态
|
|
OyeInboundResults.add(oyeInboundResult);
|
|
OyeInboundResults.add(oyeInboundResult);
|
|
}
|
|
}
|
|
oyeInboundResultMapper.batchInsert(OyeInboundResults);
|
|
oyeInboundResultMapper.batchInsert(OyeInboundResults);
|
|
@@ -176,7 +191,7 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
oyeOutboundResult.setInsertTime(new Date());
|
|
oyeOutboundResult.setInsertTime(new Date());
|
|
map.put("singleWeight",singleWeight);
|
|
map.put("singleWeight",singleWeight);
|
|
//根据区域,客户,物资,单重,米数,仓库,库区查询实时库存在不在
|
|
//根据区域,客户,物资,单重,米数,仓库,库区查询实时库存在不在
|
|
- BigDecimal inventoryId = oyeRealtimeInventoryMapper.getInventoryId(map);
|
|
|
|
|
|
+ BigDecimal inventoryId = DataChange.dataToBigDecimal(map.get("inventoryId"));
|
|
oyeOutboundResult.setInventoryId(inventoryId);
|
|
oyeOutboundResult.setInventoryId(inventoryId);
|
|
map.put("inventoryId",inventoryId);
|
|
map.put("inventoryId",inventoryId);
|
|
map.put("flag",2);
|
|
map.put("flag",2);
|
|
@@ -265,4 +280,93 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
tmstruckWeightBatch.setBatchRemark("出库生成批次");
|
|
tmstruckWeightBatch.setBatchRemark("出库生成批次");
|
|
return tmstruckWeightBatch;
|
|
return tmstruckWeightBatch;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public String updateInsertRealTime(Map<String, Object> map) throws Exception{
|
|
|
|
+ // 划分实时库存数据
|
|
|
|
+ // 针对原先的库存,需要进行出库;针对划分后的库存需要进行入库;先出后入;
|
|
|
|
+ // 创建出库需要的数据;
|
|
|
|
+ Map<String, Object> jiChuMap = new HashMap<>();
|
|
|
|
+ jiChuMap.put("inventoryId",map.get("inventoryId"));
|
|
|
|
+ OyeOutboundResult oyeOutboundResult = new OyeOutboundResult();
|
|
|
|
+ oyeOutboundResult.setId(oyeOutboundResultMapper.getResultId());
|
|
|
|
+ BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
|
|
+ BigDecimal theoryWeight = DataChange.dataToBigDecimal(map.get("theoryWeight"));
|
|
|
|
+ BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
|
|
|
|
+ if(materialNumber == null || materialNumber.intValue() == 0) {
|
|
|
|
+ throw new Exception("物资件数错误");
|
|
|
|
+ }
|
|
|
|
+ BigDecimal singleWeight = DataChange.dataToBigDecimal(map.get("singleWeight"));
|
|
|
|
+ BigDecimal meter = DataChange.dataToBigDecimal(map.get("meter"));
|
|
|
|
+ oyeOutboundResult.setSaleArea(map.get("oldSaleArea").toString());
|
|
|
|
+ oyeOutboundResult.setConsigneeId(DataChange.dataToBigDecimal(map.get("consigneeId")));
|
|
|
|
+ oyeOutboundResult.setInboundArea(map.get("inboundArea").toString());
|
|
|
|
+ oyeOutboundResult.setInboundWarehouse(map.get("inboundWarehouse").toString());
|
|
|
|
+ //更新制单日期
|
|
|
|
+ oyeOutboundResult.setMeter(meter);
|
|
|
|
+ oyeOutboundResult.setMaterialId(materialId);
|
|
|
|
+ oyeOutboundResult.setTheoryWeight(theoryWeight);
|
|
|
|
+ oyeOutboundResult.setSingleWeight(singleWeight);
|
|
|
|
+ oyeOutboundResult.setNetWeight(DataChange.dataToBigDecimal(map.get("netWeight")));
|
|
|
|
+ oyeOutboundResult.setMaterialNumber(materialNumber);
|
|
|
|
+ oyeOutboundResult.setInsertUsername(map.get("userName") + "");
|
|
|
|
+ oyeOutboundResult.setInsertTime(new Date());
|
|
|
|
+ oyeOutboundResult.setInventoryId(DataChange.dataToBigDecimal(map.get("inventoryId")));
|
|
|
|
+ oyeOutboundResult.setMaterialNumber(DataChange.dataToBigDecimal(map.get("materialNumber")));
|
|
|
|
+ oyeOutboundResult.setTheoryWeight(DataChange.dataToBigDecimal(map.get("theoryWeight")));
|
|
|
|
+ oyeOutboundResult.setNetWeight(DataChange.dataToBigDecimal(map.get("netWeight")));
|
|
|
|
+ Map<String, Object> outBoundMap = new HashMap<>();
|
|
|
|
+ outBoundMap.put("inventoryId",map.get("inventoryId"));
|
|
|
|
+ outBoundMap.put("materialNumber",oyeOutboundResult.getMaterialNumber());
|
|
|
|
+ outBoundMap.put("netWeight",oyeOutboundResult.getNetWeight());
|
|
|
|
+ outBoundMap.put("theoryWeight",oyeOutboundResult.getTheoryWeight());
|
|
|
|
+ outBoundMap.put("flag",2);
|
|
|
|
+ OyeRealtimeInventory oyeRealtimeInventoryOut = updateRealTimeInventory(outBoundMap);
|
|
|
|
+ // 创建入库需要的数据
|
|
|
|
+ OyeInboundResult oyeInboundResult = new OyeInboundResult();
|
|
|
|
+ oyeInboundResult.setResultId(oyeInboundResultMapper.getResultId());
|
|
|
|
+ oyeInboundResult.setSaleArea(map.get("saleArea").toString());
|
|
|
|
+ oyeInboundResult.setConsigneeId(DataChange.dataToBigDecimal(map.get("consigneeId")));
|
|
|
|
+ oyeInboundResult.setInboundArea(map.get("inboundArea").toString());
|
|
|
|
+ oyeInboundResult.setInboundWarehouse(map.get("inboundWarehouse").toString());
|
|
|
|
+ oyeInboundResult.setMeter(meter);
|
|
|
|
+ oyeInboundResult.setMaterialId(materialId);
|
|
|
|
+ oyeInboundResult.setTheoryWeight(theoryWeight);
|
|
|
|
+ oyeInboundResult.setSingleWeight(singleWeight);
|
|
|
|
+ oyeInboundResult.setNetWeight(DataChange.dataToBigDecimal(map.get("netWeight")));
|
|
|
|
+ oyeInboundResult.setMaterialNumber(materialNumber);
|
|
|
|
+ oyeInboundResult.setInsertUsername(map.get("userName") + "");
|
|
|
|
+ oyeInboundResult.setInsertTime(new Date());
|
|
|
|
+ map.put("singleWeight",singleWeight);
|
|
|
|
+ OyeRealtimeInventory oyeRealtimeInventoryInsert = null;
|
|
|
|
+ OyeRealtimeInventory oyeRealtimeInventoryUpdate = null;
|
|
|
|
+ //根据区域,客户,物资,单重,米数,仓库,库区查询实时库存在不在
|
|
|
|
+ BigDecimal inventoryId = oyeRealtimeInventoryMapper.getInventoryId(map);
|
|
|
|
+ if (inventoryId == null) {
|
|
|
|
+ //新增实时库存
|
|
|
|
+ map.put("flag",1);
|
|
|
|
+ oyeRealtimeInventoryInsert = insertRealTimeInventory(map);
|
|
|
|
+ oyeInboundResult.setInventoryId(oyeRealtimeInventoryInsert.getInventoryId());
|
|
|
|
+ }else{
|
|
|
|
+ map.put("inventoryId",inventoryId);
|
|
|
|
+ map.put("flag",1);
|
|
|
|
+ oyeRealtimeInventoryUpdate = updateRealTimeInventory(map);
|
|
|
|
+ }
|
|
|
|
+ if (oyeRealtimeInventoryInsert != null) {
|
|
|
|
+ oyeRealtimeInventoryMapper.insertSelective(oyeRealtimeInventoryInsert);
|
|
|
|
+ }
|
|
|
|
+ if (oyeRealtimeInventoryUpdate != null) {
|
|
|
|
+ oyeRealtimeInventoryMapper.updateByPrimaryKeySelective(oyeRealtimeInventoryUpdate);
|
|
|
|
+ }
|
|
|
|
+ oyeInboundResultMapper.insertSelective(oyeInboundResult);
|
|
|
|
+ oyeRealtimeInventoryMapper.updateByPrimaryKeySelective(oyeRealtimeInventoryOut);
|
|
|
|
+ oyeOutboundResultMapper.insertSelective(oyeOutboundResult);
|
|
|
|
+ return "操作成功";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public List<Map<String, Object>> receiveSendReport(Map<String, Object> map) {
|
|
|
|
+ return oyeRealtimeInventoryMapper.receiveSendReport(map);
|
|
|
|
+ }
|
|
}
|
|
}
|