|
@@ -143,8 +143,52 @@ public class OyeWarehouseServiceImpl implements IOyeWarehouseService {
|
|
|
AmsSaleTrucknoMaterial amsSaleTrucknoMaterial = new AmsSaleTrucknoMaterial();
|
|
|
// 遍历每一行
|
|
|
for (Map<String, Object> map : mapList) {
|
|
|
- if(!getRealTimeInfo(map)) {
|
|
|
- throw new Exception("超出实时库存数量,请调整后再次输入");
|
|
|
+ // 物资
|
|
|
+ BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
|
+ // 钢材米数
|
|
|
+ BigDecimal steelMeters = DataChange.dataToBigDecimal(map.get("meterNumber"));
|
|
|
+ if (materialId == null || materialId.intValue() == 0) {
|
|
|
+ String name = (String) map.get("materialName");
|
|
|
+ String specification = (String) map.get("materialSpecification");
|
|
|
+ String model = (String) map.get("materialModel");
|
|
|
+ Map<String,Object> materialMap = new HashMap<>();
|
|
|
+ materialMap.put("name",name);
|
|
|
+ materialMap.put("specification",specification);
|
|
|
+ if (model == null || model.equals("") || model.equals("null")) {
|
|
|
+ model = null;
|
|
|
+ }
|
|
|
+ materialMap.put("model",model);
|
|
|
+ materialId = amsSaleOrderMapper.findMaterialId(materialMap);
|
|
|
+ if (materialId == null) {
|
|
|
+ throw new Exception("您输入的物资:" + name + specification + model + "不存在!!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Object inboundWarehouseObject = map.get("inboundWarehouse");
|
|
|
+ if (inboundWarehouseObject == null || inboundWarehouseObject.equals("")) {
|
|
|
+ throw new Exception("出库库房为空!");
|
|
|
+ }
|
|
|
+ String inboundWarehouse = inboundWarehouseObject.toString();
|
|
|
+ Map<String, Object> searchInventoryMap = new HashMap<>();
|
|
|
+ searchInventoryMap.put("materialId",materialId);
|
|
|
+ searchInventoryMap.put("saleArea",saleRemark);
|
|
|
+ searchInventoryMap.put("receiveId",receiveId);
|
|
|
+ searchInventoryMap.put("meter",steelMeters);
|
|
|
+ searchInventoryMap.put("inboundWarehouse",inboundWarehouse);
|
|
|
+ BigDecimal inventoryId = DataChange.dataToBigDecimal(map.get("inventoryId"));
|
|
|
+ if (inventoryId == null || inventoryId.intValue() == 0) {
|
|
|
+ try {
|
|
|
+ inventoryId = amsSaleMaterialMapper.selectInventoryId(searchInventoryMap);
|
|
|
+ if(inventoryId == null) {
|
|
|
+ throw new Exception("无法匹配实时库存,请检查输入参数");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new Exception("无法匹配实时库存,请检查输入参数");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("inventoryId",inventoryId);
|
|
|
+ if (!getRealTimeInfo(map)) {
|
|
|
+ throw new Exception("超出实时库存数量,无法通过");
|
|
|
}
|
|
|
/*
|
|
|
车序号表
|
|
@@ -254,24 +298,7 @@ public class OyeWarehouseServiceImpl implements IOyeWarehouseService {
|
|
|
/*
|
|
|
销售订单物资表
|
|
|
*/
|
|
|
- // 物资
|
|
|
- BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
|
|
|
- if (materialId == null || materialId.intValue() == 0) {
|
|
|
- String name = (String) map.get("materialName");
|
|
|
- String specification = (String) map.get("materialSpecification");
|
|
|
- String model = (String) map.get("materialModel");
|
|
|
- Map<String,Object> materialMap = new HashMap<>();
|
|
|
- materialMap.put("name",name);
|
|
|
- materialMap.put("specification",specification);
|
|
|
- if (model == null || model.equals("") || model.equals("null")) {
|
|
|
- model = null;
|
|
|
- }
|
|
|
- materialMap.put("model",model);
|
|
|
- materialId = amsSaleOrderMapper.findMaterialId(materialMap);
|
|
|
- if (materialId == null) {
|
|
|
- throw new Exception("您输入的物资:" + name + specification + model + "不存在!!");
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
Integer materialCount = amsSaleMaterialMapper.getMaterialCount(materialId);
|
|
|
RmsMaterial rmsMaterial = new RmsMaterial();
|
|
|
rmsMaterial.setMaterialId(materialId);
|
|
@@ -284,8 +311,7 @@ public class OyeWarehouseServiceImpl implements IOyeWarehouseService {
|
|
|
BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("orderPlanWeight"));
|
|
|
// 物资名称
|
|
|
Object materialName = map.get("materialName");
|
|
|
- // 钢材米数
|
|
|
- BigDecimal steelMeters = DataChange.dataToBigDecimal(map.get("meterNumber"));
|
|
|
+
|
|
|
// 判断物资是否是盘螺或盘元/盘圆
|
|
|
if (materialName != null && (materialName.toString().contains("盘螺") || materialName.toString().contains("盘元") || materialName.toString().contains("盘圆"))) {
|
|
|
amsSaleMaterial.setSteelMeter(null);
|
|
@@ -295,18 +321,6 @@ public class OyeWarehouseServiceImpl implements IOyeWarehouseService {
|
|
|
}
|
|
|
// 是否磅重销售(0:磅重;1:理重)
|
|
|
BigDecimal isPoundSale = DataChange.dataToBigDecimal(map.get("isPound"));
|
|
|
-
|
|
|
- BigDecimal inventoryId = DataChange.dataToBigDecimal(map.get("inventoryId"));
|
|
|
- //if (inventoryId == null || inventoryId.intValue() == 0) {
|
|
|
- // if (map.get("inboundWarehouseName") == null || "".equals(map.get("inboundWarehouseName"))) {
|
|
|
- // throw new Exception("库房名称为必填");
|
|
|
- // }
|
|
|
- // Map<Object, Object> excelMap = new HashMap<>();
|
|
|
- // excelMap.put("materialId",materialId);
|
|
|
- // excelMap.put("inboundWarehouseName",map.get("inboundWarehouseName"));
|
|
|
- // excelMap.put("meter",steelMeters);
|
|
|
- // excelMap.put("singleWeight",map.get())
|
|
|
- //}
|
|
|
// 销售订单物资表主键
|
|
|
BigDecimal saleMaterialId = amsSaleMaterialMapper.selectMaxId();
|
|
|
amsSaleMaterial.setSaleMaterialId(saleMaterialId);
|
|
@@ -357,17 +371,17 @@ public class OyeWarehouseServiceImpl implements IOyeWarehouseService {
|
|
|
for (Map<String,Object> approveMap : mapList) {
|
|
|
if (DataChange.dataToBigDecimal(approveMap.get("orderStatus")).intValue() == 4) {
|
|
|
try {
|
|
|
- Boolean flag = getRealTimeInfo(approveMap);
|
|
|
- if(flag) {
|
|
|
- i += amsSaleOrderMapper.approveTransPlan(approveMap);
|
|
|
- }else{
|
|
|
- continue;
|
|
|
- }
|
|
|
+ i += amsSaleOrderMapper.approveTransPlan(approveMap);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
+ if(DataChange.dataToBigDecimal(approveMap.get("deleted")).intValue() == 1) {
|
|
|
+ //删除
|
|
|
+ i += amsSaleOrderMapper.updateFluStatus(approveMap);
|
|
|
+ //i += amsSaleOrderMapper.approveTransPlan(approveMap);
|
|
|
+ }
|
|
|
}
|
|
|
return "共提交" + j + "条" + "单据;成功" + i + "条";
|
|
|
}
|
|
@@ -375,13 +389,17 @@ public class OyeWarehouseServiceImpl implements IOyeWarehouseService {
|
|
|
//根据销售订单子表ID,判断待出库的一个数量
|
|
|
public synchronized Boolean getRealTimeInfo(Map<String,Object> map) throws Exception {
|
|
|
BigDecimal inventoryId = DataChange.dataToBigDecimal(map.get("inventoryId"));
|
|
|
+ //获取下单数量
|
|
|
BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("orderPlanWeight"));
|
|
|
//根据库存ID,统计所有未装但已制订计划的正常单据
|
|
|
+ //获取未装物资数量
|
|
|
BigDecimal unloadMaterialNumber = amsSaleMaterialMapper.getRealTimeUnloadNumber(inventoryId);
|
|
|
+ //
|
|
|
BigDecimal realTimeMaterialNumber = amsSaleMaterialMapper.getRealTimeMaterialNumber(inventoryId);
|
|
|
if (realTimeMaterialNumber.intValue() == 0) {
|
|
|
throw new Exception("该实时库存无数量,无法下单");
|
|
|
}
|
|
|
+ System.out.println(realTimeMaterialNumber.subtract(unloadMaterialNumber));
|
|
|
if (realTimeMaterialNumber.subtract(unloadMaterialNumber).compareTo(materialNumber) >= 0) {
|
|
|
return true;
|
|
|
}
|