|
@@ -74,11 +74,18 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
|
System.out.println(jsonObject);
|
|
|
System.out.println("===========" + new Date());
|
|
|
for (Map<String,Object> map : mapList) {
|
|
|
+ //判断该拼是否入库
|
|
|
+ if (oyeInboundResultMapper.selectSaleMaterialID(DataChange.dataToBigDecimal(map.get("saleMaterialId"))) != null) {
|
|
|
+ throw new Exception("该分录已入库,无法继续入库");
|
|
|
+ }
|
|
|
+ //根据分录ID查询理重
|
|
|
+ BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
|
|
|
+ BigDecimal theoryWeightSaleMaterial = oyeRealtimeInventoryMapper.getTheoryWeight(DataChange.dataToBigDecimal(map.get("saleMaterialId")));
|
|
|
+ BigDecimal singleWeight = theoryWeightSaleMaterial.divide(materialNumber,4,BigDecimal.ROUND_HALF_UP);
|
|
|
+ //根据分录理重
|
|
|
OyeInboundResult oyeInboundResult = new OyeInboundResult();
|
|
|
BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
|
BigDecimal theoryWeight = DataChange.dataToBigDecimal(map.get("theoryWeight"));
|
|
|
- BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
|
|
|
- BigDecimal singleWeight = theoryWeight.divide(materialNumber,4,BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal meter = DataChange.dataToBigDecimal(map.get("meter"));
|
|
|
oyeInboundResult.setResultId(oyeInboundResultMapper.getResultId());
|
|
|
oyeInboundResult.setSaleArea(map.get("saleArea").toString());
|
|
@@ -86,10 +93,6 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
|
oyeInboundResult.setCapacityId(DataChange.dataToBigDecimal(map.get("capacityId")));
|
|
|
oyeInboundResult.setOrderId(DataChange.dataToBigDecimal(map.get("orderId")));
|
|
|
oyeInboundResult.setSaleMaterialId(DataChange.dataToBigDecimal(map.get("saleMaterialId")));
|
|
|
- //判断该拼是否入库
|
|
|
- if (oyeInboundResultMapper.selectSaleMaterialID(DataChange.dataToBigDecimal(map.get("saleMaterialId"))) != null) {
|
|
|
- throw new Exception("该分录已入库,无法继续入库");
|
|
|
- }
|
|
|
oyeInboundResult.setCapacityNumbher(map.get("capacityNumber") + "");
|
|
|
oyeInboundResult.setInboundArea(map.get("inboundArea").toString());
|
|
|
oyeInboundResult.setInboundWarehouse(map.get("inboundWarehouse").toString());
|
|
@@ -157,14 +160,30 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
|
System.out.println(jsonObject);
|
|
|
System.out.println("===========" + new Date());
|
|
|
for (Map<String,Object> map : mapList) {
|
|
|
+ //判断该拼是否出库
|
|
|
+ if (oyeOutboundResultMapper.selectSaleMaterialID(DataChange.dataToBigDecimal(map.get("saleMaterialId"))) != null) {
|
|
|
+ throw new Exception("该分录已出库,无法继续出库");
|
|
|
+ }
|
|
|
+ //根据实时库存ID获取单重
|
|
|
+ BigDecimal inventoryId = DataChange.dataToBigDecimal(map.get("inventoryId"));
|
|
|
+ BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
|
|
|
+ BigDecimal singleWeight = oyeRealtimeInventoryMapper.getSingleWeight(inventoryId);
|
|
|
+ BigDecimal theoryWeightSaleMaterial = singleWeight.multiply(materialNumber);
|
|
|
OyeOutboundResult oyeOutboundResult = new OyeOutboundResult();
|
|
|
BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
|
BigDecimal theoryWeight = DataChange.dataToBigDecimal(map.get("theoryWeight"));
|
|
|
- BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
|
|
|
+ BigDecimal netWeight = DataChange.dataToBigDecimal(map.get("netWeight"));
|
|
|
if(materialNumber == null || materialNumber.intValue() == 0) {
|
|
|
throw new Exception("物资件数错误");
|
|
|
}
|
|
|
- BigDecimal singleWeight = theoryWeight.divide(materialNumber);
|
|
|
+ //查询比例
|
|
|
+ BigDecimal compareValue = DataChange.dataToBigDecimal(oyeRealtimeInventoryMapper.selectCompareValue());
|
|
|
+ BigDecimal theoryAdd = theoryWeightSaleMaterial.multiply(compareValue.add(new BigDecimal(1)));
|
|
|
+ BigDecimal theorySub = theoryWeightSaleMaterial.multiply(new BigDecimal(1).subtract(compareValue));
|
|
|
+ if (netWeight.compareTo(theoryAdd) > 0 || netWeight.compareTo(theorySub) < 0) {
|
|
|
+ throw new Exception("净重不在理重的" + compareValue + "范围内");
|
|
|
+ }
|
|
|
+ //BigDecimal singleWeight = theoryWeight.divide(materialNumber);
|
|
|
BigDecimal meter = DataChange.dataToBigDecimal(map.get("meter"));
|
|
|
oyeOutboundResult.setResultId(oyeOutboundResultMapper.getResultId());
|
|
|
oyeOutboundResult.setSaleArea(map.get("saleArea").toString());
|
|
@@ -176,22 +195,18 @@ public class OyeResultServiceImpl implements IOyeResultService {
|
|
|
oyeOutboundResult.setInboundArea(map.get("inboundArea").toString());
|
|
|
oyeOutboundResult.setInboundWarehouse(map.get("inboundWarehouse").toString());
|
|
|
oyeOutboundResult.setSaleMaterialId(DataChange.dataToBigDecimal(map.get("saleMaterialId")));
|
|
|
- //判断该拼是否出库
|
|
|
- if (oyeOutboundResultMapper.selectSaleMaterialID(DataChange.dataToBigDecimal(map.get("saleMaterialId"))) != null) {
|
|
|
- throw new Exception("该分录已出库,无法继续出库");
|
|
|
- }
|
|
|
+
|
|
|
//更新制单日期
|
|
|
oyeOutboundResult.setMeter(meter);
|
|
|
oyeOutboundResult.setMaterialId(materialId);
|
|
|
oyeOutboundResult.setTheoryWeight(theoryWeight);
|
|
|
oyeOutboundResult.setSingleWeight(singleWeight);
|
|
|
- oyeOutboundResult.setNetWeight(DataChange.dataToBigDecimal(map.get("netWeight")));
|
|
|
+ oyeOutboundResult.setNetWeight(netWeight);
|
|
|
oyeOutboundResult.setMaterialNumber(materialNumber);
|
|
|
oyeOutboundResult.setInsertUsername(map.get("userName") + "");
|
|
|
oyeOutboundResult.setInsertTime(new Date());
|
|
|
map.put("singleWeight",singleWeight);
|
|
|
//根据区域,客户,物资,单重,米数,仓库,库区查询实时库存在不在
|
|
|
- BigDecimal inventoryId = DataChange.dataToBigDecimal(map.get("inventoryId"));
|
|
|
oyeOutboundResult.setInventoryId(inventoryId);
|
|
|
map.put("inventoryId",inventoryId);
|
|
|
map.put("flag",2);
|