|
@@ -32,7 +32,6 @@ import com.iamberry.rst.service.order.mapper.ProvincesLogisticsMapper;
|
|
import com.iamberry.rst.service.product.mapper.ProductMapper;
|
|
import com.iamberry.rst.service.product.mapper.ProductMapper;
|
|
import com.iamberry.rst.service.sys.mapper.SysConfigMapper;
|
|
import com.iamberry.rst.service.sys.mapper.SysConfigMapper;
|
|
import com.iamberry.rst.util.PageUtil;
|
|
import com.iamberry.rst.util.PageUtil;
|
|
-import com.iamberry.wechat.core.entity.AdminUtils;
|
|
|
|
import com.iamberry.wechat.tools.DateTimeUtil;
|
|
import com.iamberry.wechat.tools.DateTimeUtil;
|
|
import net.sf.json.JSONArray;
|
|
import net.sf.json.JSONArray;
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
@@ -181,7 +180,18 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
// 如果已出库则返还库存
|
|
// 如果已出库则返还库存
|
|
SalesOrder so = salesOrderMapper.getSalesOrderById(salesOrder.getSalesId());
|
|
SalesOrder so = salesOrderMapper.getSalesOrderById(salesOrder.getSalesId());
|
|
if(so.getSalesDeliver() == 2){
|
|
if(so.getSalesDeliver() == 2){
|
|
- returnInventory(salesOrder.getSalesId(),so.getSalesWarehouseId());
|
|
|
|
|
|
+ SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
|
+ salesOrderItem.setItemOrderId(so.getSalesId());
|
|
|
|
+ List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
|
|
|
|
+ for (SalesOrderItem soi:listOrderitem) {
|
|
|
|
+ InventoryInfo inventoryInfo2 = new InventoryInfo();
|
|
|
|
+ inventoryInfo2.setInventoryGoodProductNum(soi.getItemNum()); //良品数量
|
|
|
|
+ inventoryInfo2.setInventoryProductBar(soi.getItemColorBar());
|
|
|
|
+ inventoryInfo2.setWarehouseId(so.getSalesWarehouseId());
|
|
|
|
+ inventoryInfo2.setLogType(1); //类型1.采购 2.发货 3.次品
|
|
|
|
+ inventoryInfo2.setInventoryRecentRecord("作废订单返还库存-作废订单号:"+ so.getSalesDealCode());
|
|
|
|
+ inventoryService.addInventory(inventoryInfo2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 1;
|
|
return 1;
|
|
@@ -266,14 +276,6 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //计算价格
|
|
|
|
- calculationTotal(salesOrder,salesOrder.getSalesOrderItemList());
|
|
|
|
-
|
|
|
|
- //修改订单
|
|
|
|
- if (salesOrderMapper.updateSalesOrder(salesOrder) <= 0) {
|
|
|
|
- throw new RuntimeException("修改订单失败!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// 批量修改订单项
|
|
// 批量修改订单项
|
|
if(updateSalesOrderItemList.size() > 0) {
|
|
if(updateSalesOrderItemList.size() > 0) {
|
|
for (SalesOrderItem salesOrderItem : updateSalesOrderItemList) {
|
|
for (SalesOrderItem salesOrderItem : updateSalesOrderItemList) {
|
|
@@ -288,6 +290,15 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //计算价格
|
|
|
|
+ List<SalesOrderItem> nowSalesOrderItemList = salesOrderMapper.listSalesOrderItem(soi);
|
|
|
|
+ calculationTotal(salesOrder,nowSalesOrderItemList);
|
|
|
|
+
|
|
|
|
+ //修改订单
|
|
|
|
+ if (salesOrderMapper.updateSalesOrder(salesOrder) <= 0) {
|
|
|
|
+ throw new RuntimeException("修改订单失败!");
|
|
|
|
+ }
|
|
|
|
+
|
|
// 更新Redis缓存
|
|
// 更新Redis缓存
|
|
cacheOrderItem(salesOrder.getSalesId());
|
|
cacheOrderItem(salesOrder.getSalesId());
|
|
return flag;
|
|
return flag;
|
|
@@ -1204,7 +1215,19 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
//查询出库状态判断是否需要返还库存
|
|
//查询出库状态判断是否需要返还库存
|
|
SalesOrder so = salesOrderMapper.getSalesOrderById(id);
|
|
SalesOrder so = salesOrderMapper.getSalesOrderById(id);
|
|
if(so.getSalesDeliver() == 2){
|
|
if(so.getSalesDeliver() == 2){
|
|
- returnInventory(id,so.getSalesWarehouseId());
|
|
|
|
|
|
+ SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
|
+ salesOrderItem.setItemOrderId(so.getSalesId());
|
|
|
|
+ List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
|
|
|
|
+ for (SalesOrderItem soi:listOrderitem) {
|
|
|
|
+ InventoryInfo inventoryInfo2 = new InventoryInfo();
|
|
|
|
+ inventoryInfo2.setInventoryGoodProductNum(soi.getItemNum()); //良品数量
|
|
|
|
+ inventoryInfo2.setInventoryProductBar(soi.getItemColorBar());
|
|
|
|
+ inventoryInfo2.setWarehouseId(so.getSalesWarehouseId());
|
|
|
|
+ inventoryInfo2.setLogType(1); //类型1.采购 2.发货 3.次品
|
|
|
|
+ inventoryInfo2.setQualityType(1); //产品质量类型 1良品 2 不良品
|
|
|
|
+ inventoryInfo2.setInventoryRecentRecord("删除订单返还库存-删除订单号:"+ so.getSalesDealCode());
|
|
|
|
+ inventoryService.addInventory(inventoryInfo2);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//判断是否绑定维修信息,并解除绑定
|
|
//判断是否绑定维修信息,并解除绑定
|
|
if(so != null){
|
|
if(so != null){
|
|
@@ -1412,10 +1435,11 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public synchronized Integer updateDeliver(SalesOrder salesOrder) {
|
|
public synchronized Integer updateDeliver(SalesOrder salesOrder) {
|
|
- Integer flag = salesOrderMapper.updateDeliver(salesOrder);
|
|
|
|
- if(flag < 1){
|
|
|
|
- throw new RuntimeException("出库失败,订单出库失败。");
|
|
|
|
- }
|
|
|
|
|
|
+ Integer flag = 0;
|
|
|
|
+// Integer flag = salesOrderMapper.updateDeliver(salesOrder);
|
|
|
|
+// if(flag < 1){
|
|
|
|
+// throw new RuntimeException("出库失败,订单出库失败。");
|
|
|
|
+// }
|
|
|
|
|
|
boolean isMachineRetuen = false; //是否原机退回
|
|
boolean isMachineRetuen = false; //是否原机退回
|
|
ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();
|
|
ComplaintDetectInfo complaintDetectInfo = new ComplaintDetectInfo();
|
|
@@ -1434,154 +1458,164 @@ public class SalesOrderServiceImpl implements SalesOrderService {
|
|
inventoryInfo1.setInventoryDefectiveProductNum(1);
|
|
inventoryInfo1.setInventoryDefectiveProductNum(1);
|
|
inventoryInfo1.setInventoryProductColorId(cdinfo.getProductColorId());
|
|
inventoryInfo1.setInventoryProductColorId(cdinfo.getProductColorId());
|
|
inventoryInfo1.setWarehouseId(2);
|
|
inventoryInfo1.setWarehouseId(2);
|
|
|
|
+ inventoryInfo1.setQualityType(2); //产品质量类型 1良品 2 不良品
|
|
inventoryInfo1.setInventoryRecentRecord("维修机器-原机返回(维修ID:" + cdinfo.getDetectNumber() + ")");
|
|
inventoryInfo1.setInventoryRecentRecord("维修机器-原机返回(维修ID:" + cdinfo.getDetectNumber() + ")");
|
|
flag = inventoryService.minusInventory(inventoryInfo1);
|
|
flag = inventoryService.minusInventory(inventoryInfo1);
|
|
if (flag < 1) {
|
|
if (flag < 1) {
|
|
throw new RuntimeException("出库失败。维修库存调整失败");
|
|
throw new RuntimeException("出库失败。维修库存调整失败");
|
|
}
|
|
}
|
|
- }else{ //正常库存出库(包含正常销售与售后)
|
|
|
|
|
|
+ }else{
|
|
|
|
+ //正常库存出库(包含正常销售与售后)
|
|
|
|
+ SalesOrder so = salesOrderMapper.getSalesOrderById(salesOrder.getSalesId());SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
|
+ salesOrderItem.setItemOrderId(so.getSalesId());
|
|
|
|
+ List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
|
|
if(salesOrder.getSalesDeliver() == 2){//标记出库,修改库存
|
|
if(salesOrder.getSalesDeliver() == 2){//标记出库,修改库存
|
|
- if(!salesOrderService.updateInventory(salesOrder.getSalesId(),salesOrder.getSalesWarehouseId())){
|
|
|
|
- throw new RuntimeException("出库失败,【出库】库存修改失败。");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(salesOrder.getSalesDeliver() == 1){//标记未出库,修改库存
|
|
|
|
- if(!salesOrderService.returnInventory(salesOrder.getSalesId(),salesOrder.getSalesWarehouseId())){
|
|
|
|
- throw new RuntimeException("出库失败,【返还库存】库存修改失败。");
|
|
|
|
|
|
+ // 如果已出库则返还库存
|
|
|
|
+ for (SalesOrderItem soi:listOrderitem) {
|
|
|
|
+ InventoryInfo inventoryInfo2 = new InventoryInfo();
|
|
|
|
+ inventoryInfo2.setInventoryGoodProductNum(soi.getItemNum()); //良品数量
|
|
|
|
+ inventoryInfo2.setInventoryProductBar(soi.getItemColorBar());
|
|
|
|
+ inventoryInfo2.setWarehouseId(so.getSalesWarehouseId());
|
|
|
|
+ inventoryInfo2.setLogType(1); //类型1.采购 2.发货 3.次品
|
|
|
|
+ inventoryInfo2.setQualityType(1); //产品质量类型 1良品 2 不良品
|
|
|
|
+ inventoryInfo2.setInventoryRecentRecord("出库-订单号:"+ so.getSalesDealCode());
|
|
|
|
+ inventoryService.minusInventory(inventoryInfo2);
|
|
}
|
|
}
|
|
|
|
+ }else{
|
|
|
|
+ throw new RuntimeException("出库失败");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
|
|
//减少库存
|
|
//减少库存
|
|
- @Transactional
|
|
|
|
- @Override
|
|
|
|
- public boolean updateInventory(Integer salesId,Integer salesWarehouseId){
|
|
|
|
- OrderWarehouse orderWarehouse = orderWarehouseService.getOrderWarehouseById(salesWarehouseId);
|
|
|
|
- if(orderWarehouse == null){
|
|
|
|
- throw new RuntimeException("【出库】更新库存失败,查询仓库信息失败。");
|
|
|
|
- }
|
|
|
|
- String warehouseName = orderWarehouse.getWarehouseName();
|
|
|
|
-
|
|
|
|
- SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
|
- salesOrderItem.setItemOrderId(salesId);
|
|
|
|
- List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
|
|
|
|
-
|
|
|
|
- for(SalesOrderItem item : listOrderitem){
|
|
|
|
- List<ProductCombinatInfo> listproduct = productMapper.combinatList(item.getItemProductId());
|
|
|
|
- if(listproduct.size() > 0){
|
|
|
|
- for(ProductCombinatInfo combinatInfo : listproduct){
|
|
|
|
- invIne(item,orderWarehouse,combinatInfo);
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- invIne(item,orderWarehouse,null);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void invIne(SalesOrderItem item,OrderWarehouse orderWarehouse,ProductCombinatInfo combinatInfo){
|
|
|
|
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- Integer combinatItemNum;
|
|
|
|
- if(combinatInfo == null ){
|
|
|
|
- combinatItemNum = 1;
|
|
|
|
- }else{
|
|
|
|
- combinatItemNum = combinatInfo.getCombinatItemNum();
|
|
|
|
- item.setItemColorBar(productService.getProduceColor(combinatInfo.getCombinatItemColorId()).getColorBar());
|
|
|
|
- }
|
|
|
|
- InventoryInfo infos = inventoryMapper.getByInventoryByBar(item.getItemColorBar(),orderWarehouse.getWarehouseId());
|
|
|
|
- if(infos != null){
|
|
|
|
- if(infos.getInventoryGoodProductNum() >= (item.getItemNum() * combinatItemNum)){
|
|
|
|
- infos.setInventoryGoodProductNum(infos.getInventoryGoodProductNum() - (item.getItemNum() * combinatItemNum));
|
|
|
|
- infos.setInventoryRecentRecord(sdf.format(new Date())+"出库"+item.getItemNum()+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
- Integer flag = inventoryMapper.updateById(infos);
|
|
|
|
- if(flag < 1){
|
|
|
|
- throw new RuntimeException("【出库】更新库存失败,库存修改失败。");
|
|
|
|
- }
|
|
|
|
- //添加日志
|
|
|
|
- InventoryLog inventoryLog = new InventoryLog();
|
|
|
|
- inventoryLog.setLogProductName(infos.getInventoryProductName());
|
|
|
|
- inventoryLog.setLogProductBar(infos.getInventoryProductBar());
|
|
|
|
- inventoryLog.setLogRemainingNum(item.getItemNum() * combinatItemNum);
|
|
|
|
- inventoryLog.setLogType(2);
|
|
|
|
- inventoryLog.setLogOperationType(2);
|
|
|
|
- inventoryLog.setLogDesc(sdf.format(new Date())+"待发货标记出库"+item.getItemNum()+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
- inventoryLog.setLogQualityType(1);
|
|
|
|
- inventoryLog.setLogWarehouseId(orderWarehouse.getWarehouseId());
|
|
|
|
- flag = inventoryLogMapper.insert(inventoryLog);
|
|
|
|
- if(flag < 1){
|
|
|
|
- throw new RuntimeException("【出库】更新库存失败,增加库存记录失败。");
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- throw new RuntimeException("【出库】更新库存失败,"+ orderWarehouse.getWarehouseName() +"["+ item.getItemProductName()+ "("+ item.getItemProductColor() +")" +"]库存不足。");
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- throw new RuntimeException("【出库】更新库存失败,未查询到库存信息,请确认“"+ orderWarehouse.getWarehouseName() +"”是否有该产品["+ item.getItemProductName()+ "("+ item.getItemProductColor() +")" +"]库存信息。");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// @Transactional
|
|
|
|
+// @Override
|
|
|
|
+// public boolean updateInventory(Integer salesId,Integer salesWarehouseId){
|
|
|
|
+// OrderWarehouse orderWarehouse = orderWarehouseService.getOrderWarehouseById(salesWarehouseId);
|
|
|
|
+// if(orderWarehouse == null){
|
|
|
|
+// throw new RuntimeException("【出库】更新库存失败,查询仓库信息失败。");
|
|
|
|
+// }
|
|
|
|
+// String warehouseName = orderWarehouse.getWarehouseName();
|
|
|
|
+//
|
|
|
|
+// SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
|
+// salesOrderItem.setItemOrderId(salesId);
|
|
|
|
+// List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
|
|
|
|
+//
|
|
|
|
+// for(SalesOrderItem item : listOrderitem){
|
|
|
|
+// List<ProductCombinatInfo> listproduct = productMapper.combinatList(item.getItemProductId());
|
|
|
|
+// if(listproduct.size() > 0){
|
|
|
|
+// for(ProductCombinatInfo combinatInfo : listproduct){
|
|
|
|
+// invIne(item,orderWarehouse,combinatInfo);
|
|
|
|
+// }
|
|
|
|
+// }else{
|
|
|
|
+// invIne(item,orderWarehouse,null);
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+// return true;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// public void invIne(SalesOrderItem item,OrderWarehouse orderWarehouse,ProductCombinatInfo combinatInfo){
|
|
|
|
+// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+// Integer combinatItemNum;
|
|
|
|
+// if(combinatInfo == null ){
|
|
|
|
+// combinatItemNum = 1;
|
|
|
|
+// }else{
|
|
|
|
+// combinatItemNum = combinatInfo.getCombinatItemNum();
|
|
|
|
+// item.setItemColorBar(productService.getProduceColor(combinatInfo.getCombinatItemColorId()).getColorBar());
|
|
|
|
+// }
|
|
|
|
+// InventoryInfo infos = inventoryMapper.getByInventoryByBar(item.getItemColorBar(),orderWarehouse.getWarehouseId());
|
|
|
|
+// if(infos != null){
|
|
|
|
+// if(infos.getInventoryGoodProductNum() >= (item.getItemNum() * combinatItemNum)){
|
|
|
|
+// infos.setInventoryGoodProductNum(infos.getInventoryGoodProductNum() - (item.getItemNum() * combinatItemNum));
|
|
|
|
+// infos.setInventoryRecentRecord(sdf.format(new Date())+"出库"+item.getItemNum()+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
+// Integer flag = inventoryMapper.updateById(infos);
|
|
|
|
+// if(flag < 1){
|
|
|
|
+// throw new RuntimeException("【出库】更新库存失败,库存修改失败。");
|
|
|
|
+// }
|
|
|
|
+// //添加日志
|
|
|
|
+// InventoryLog inventoryLog = new InventoryLog();
|
|
|
|
+// inventoryLog.setLogProductName(infos.getInventoryProductName());
|
|
|
|
+// inventoryLog.setLogProductBar(infos.getInventoryProductBar());
|
|
|
|
+// inventoryLog.setLogRemainingNum(item.getItemNum() * combinatItemNum);
|
|
|
|
+// inventoryLog.setLogType(2);
|
|
|
|
+// inventoryLog.setLogOperationType(2);
|
|
|
|
+// inventoryLog.setLogDesc(sdf.format(new Date())+"待发货标记出库"+item.getItemNum()+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
+// inventoryLog.setLogQualityType(1);
|
|
|
|
+// inventoryLog.setLogWarehouseId(orderWarehouse.getWarehouseId());
|
|
|
|
+// flag = inventoryLogMapper.insert(inventoryLog);
|
|
|
|
+// if(flag < 1){
|
|
|
|
+// throw new RuntimeException("【出库】更新库存失败,增加库存记录失败。");
|
|
|
|
+// }
|
|
|
|
+// }else{
|
|
|
|
+// throw new RuntimeException("【出库】更新库存失败,"+ orderWarehouse.getWarehouseName() +"["+ item.getItemProductName()+ "("+ item.getItemProductColor() +")" +"]库存不足。");
|
|
|
|
+// }
|
|
|
|
+// }else{
|
|
|
|
+// throw new RuntimeException("【出库】更新库存失败,未查询到库存信息,请确认“"+ orderWarehouse.getWarehouseName() +"”是否有该产品["+ item.getItemProductName()+ "("+ item.getItemProductColor() +")" +"]库存信息。");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
//标记未出库时返还库存
|
|
//标记未出库时返还库存
|
|
- @Transactional
|
|
|
|
- @Override
|
|
|
|
- public boolean returnInventory(Integer salesId,Integer salesWarehouseId){
|
|
|
|
- OrderWarehouse orderWarehouse = orderWarehouseService.getOrderWarehouseById(salesWarehouseId);
|
|
|
|
- if(orderWarehouse == null){
|
|
|
|
- throw new RuntimeException("【返还库存】更新库存失败,查询仓库信息失败。");
|
|
|
|
- }
|
|
|
|
- String warehouseName = orderWarehouse.getWarehouseName();
|
|
|
|
-
|
|
|
|
- SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
|
- salesOrderItem.setItemOrderId(salesId);
|
|
|
|
- List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
|
|
|
|
- for(SalesOrderItem item : listOrderitem){
|
|
|
|
- List<ProductCombinatInfo> listproduct = productMapper.combinatList(item.getItemProductId());
|
|
|
|
- if(listOrderitem.size() > 0){
|
|
|
|
- for(ProductCombinatInfo combinatInfo : listproduct){
|
|
|
|
- invTwo(item,orderWarehouse,combinatInfo);
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- invTwo(item,orderWarehouse,null);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void invTwo(SalesOrderItem item,OrderWarehouse orderWarehouse,ProductCombinatInfo combinatInfo){
|
|
|
|
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- Integer combinatItemNum;
|
|
|
|
- if(combinatInfo == null ){
|
|
|
|
- combinatItemNum = 1;
|
|
|
|
- }else{
|
|
|
|
- combinatItemNum = combinatInfo.getCombinatItemNum();
|
|
|
|
- item.setItemColorBar(productService.getProduceColor(combinatInfo.getCombinatItemColorId()).getColorBar());
|
|
|
|
- }
|
|
|
|
- InventoryInfo info = inventoryMapper.getByInventoryByBar(item.getItemColorBar(),orderWarehouse.getWarehouseId());
|
|
|
|
- if(info != null){
|
|
|
|
- info.setInventoryGoodProductNum(info.getInventoryGoodProductNum() + (item.getItemNum() * combinatItemNum));
|
|
|
|
- info.setInventoryRecentRecord(sdf.format(new Date())+"删除/作废/标记未出库时订单返还库存"+(item.getItemNum() * combinatItemNum)+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
- Integer flag = inventoryMapper.updateById(info);
|
|
|
|
- if(flag < 1){
|
|
|
|
- throw new RuntimeException("【返还库存】更新库存失败,库存修改失败。");
|
|
|
|
- }
|
|
|
|
- //添加日志
|
|
|
|
- InventoryLog inventoryLog = new InventoryLog();
|
|
|
|
- inventoryLog.setLogProductName(info.getInventoryProductName());
|
|
|
|
- inventoryLog.setLogProductBar(info.getInventoryProductBar());
|
|
|
|
- inventoryLog.setLogRemainingNum((item.getItemNum() * combinatItemNum));
|
|
|
|
- inventoryLog.setLogType(1);
|
|
|
|
- inventoryLog.setLogOperationType(1);
|
|
|
|
- inventoryLog.setLogDesc(sdf.format(new Date())+"删除/作废/标记未出库时订单返还库存"+(item.getItemNum() * combinatItemNum)+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
- inventoryLog.setLogQualityType(1);
|
|
|
|
- inventoryLog.setLogWarehouseId(orderWarehouse.getWarehouseId());
|
|
|
|
- flag = inventoryLogMapper.insert(inventoryLog);
|
|
|
|
- if(flag < 1){
|
|
|
|
- throw new RuntimeException("【返还库存】更新库存失败,增加库存记录失败。");
|
|
|
|
- }
|
|
|
|
- }else{
|
|
|
|
- throw new RuntimeException("【返还库存】更新库存失败,未查询到库存信息,请确认“"+ orderWarehouse.getWarehouseName() +"”是否有该产品["+ item.getItemProductName()+ "("+ item.getItemProductColor() +")" +"]库存信息。");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// @Transactional
|
|
|
|
+// @Override
|
|
|
|
+// public boolean returnInventory(Integer salesId,Integer salesWarehouseId){
|
|
|
|
+// OrderWarehouse orderWarehouse = orderWarehouseService.getOrderWarehouseById(salesWarehouseId);
|
|
|
|
+// if(orderWarehouse == null){
|
|
|
|
+// throw new RuntimeException("【返还库存】更新库存失败,查询仓库信息失败。");
|
|
|
|
+// }
|
|
|
|
+// String warehouseName = orderWarehouse.getWarehouseName();
|
|
|
|
+//
|
|
|
|
+// SalesOrderItem salesOrderItem = new SalesOrderItem();
|
|
|
|
+// salesOrderItem.setItemOrderId(salesId);
|
|
|
|
+// List<SalesOrderItem> listOrderitem = salesOrderService.listSalesOrderItem(salesOrderItem);
|
|
|
|
+// for(SalesOrderItem item : listOrderitem){
|
|
|
|
+// List<ProductCombinatInfo> listproduct = productMapper.combinatList(item.getItemProductId());
|
|
|
|
+// if(listOrderitem.size() > 0){
|
|
|
|
+// for(ProductCombinatInfo combinatInfo : listproduct){
|
|
|
|
+// invTwo(item,orderWarehouse,combinatInfo);
|
|
|
|
+// }
|
|
|
|
+// }else{
|
|
|
|
+// invTwo(item,orderWarehouse,null);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// return true;
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// private void invTwo(SalesOrderItem item,OrderWarehouse orderWarehouse,ProductCombinatInfo combinatInfo){
|
|
|
|
+// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+// Integer combinatItemNum;
|
|
|
|
+// if(combinatInfo == null ){
|
|
|
|
+// combinatItemNum = 1;
|
|
|
|
+// }else{
|
|
|
|
+// combinatItemNum = combinatInfo.getCombinatItemNum();
|
|
|
|
+// item.setItemColorBar(productService.getProduceColor(combinatInfo.getCombinatItemColorId()).getColorBar());
|
|
|
|
+// }
|
|
|
|
+// InventoryInfo info = inventoryMapper.getByInventoryByBar(item.getItemColorBar(),orderWarehouse.getWarehouseId());
|
|
|
|
+// if(info != null){
|
|
|
|
+// info.setInventoryGoodProductNum(info.getInventoryGoodProductNum() + (item.getItemNum() * combinatItemNum));
|
|
|
|
+// info.setInventoryRecentRecord(sdf.format(new Date())+"删除/作废/标记未出库时订单返还库存"+(item.getItemNum() * combinatItemNum)+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
+// Integer flag = inventoryMapper.updateById(info);
|
|
|
|
+// if(flag < 1){
|
|
|
|
+// throw new RuntimeException("【返还库存】更新库存失败,库存修改失败。");
|
|
|
|
+// }
|
|
|
|
+// //添加日志
|
|
|
|
+// InventoryLog inventoryLog = new InventoryLog();
|
|
|
|
+// inventoryLog.setLogProductName(info.getInventoryProductName());
|
|
|
|
+// inventoryLog.setLogProductBar(info.getInventoryProductBar());
|
|
|
|
+// inventoryLog.setLogRemainingNum((item.getItemNum() * combinatItemNum));
|
|
|
|
+// inventoryLog.setLogType(1);
|
|
|
|
+// inventoryLog.setLogOperationType(1);
|
|
|
|
+// inventoryLog.setLogDesc(sdf.format(new Date())+"删除/作废/标记未出库时订单返还库存"+(item.getItemNum() * combinatItemNum)+"件,订单号:"+item.getSalesOrderId());
|
|
|
|
+// inventoryLog.setLogQualityType(1);
|
|
|
|
+// inventoryLog.setLogWarehouseId(orderWarehouse.getWarehouseId());
|
|
|
|
+// flag = inventoryLogMapper.insert(inventoryLog);
|
|
|
|
+// if(flag < 1){
|
|
|
|
+// throw new RuntimeException("【返还库存】更新库存失败,增加库存记录失败。");
|
|
|
|
+// }
|
|
|
|
+// }else{
|
|
|
|
+// throw new RuntimeException("【返还库存】更新库存失败,未查询到库存信息,请确认“"+ orderWarehouse.getWarehouseName() +"”是否有该产品["+ item.getItemProductName()+ "("+ item.getItemProductColor() +")" +"]库存信息。");
|
|
|
|
+// }
|
|
|
|
+// }
|
|
@Override
|
|
@Override
|
|
public List<SalesOrderItem> getDeliverNum(SalesOrder salesOrder) {
|
|
public List<SalesOrderItem> getDeliverNum(SalesOrder salesOrder) {
|
|
return salesOrderMapper.getDeliverNum(salesOrder);
|
|
return salesOrderMapper.getDeliverNum(salesOrder);
|