|
@@ -10,6 +10,7 @@ import com.iamberry.rst.core.order.Product;
|
|
|
import com.iamberry.rst.core.order.ProductColor;
|
|
|
import com.iamberry.rst.core.page.PageRequest;
|
|
|
import com.iamberry.rst.core.page.PagedResult;
|
|
|
+import com.iamberry.rst.faces.cm.InventoryService;
|
|
|
import com.iamberry.rst.faces.fm.ComplaintSignclosedInfoService;
|
|
|
import com.iamberry.rst.faces.sms.SmsService;
|
|
|
import com.iamberry.rst.service.cm.mapper.*;
|
|
@@ -53,6 +54,9 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
|
|
|
@Autowired
|
|
|
private SmsService smsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private InventoryService inventoryService;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Integer insert(ComplaintSignclosedInfo record,
|
|
@@ -97,9 +101,7 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if(num < 1){
|
|
|
- return msg;//新增签收失败
|
|
|
- }else{
|
|
|
+ if(num > 0){
|
|
|
if(orderItemString != null){
|
|
|
JSONArray jsonArray = JSONArray.fromObject(orderItemString);
|
|
|
List<SalesOrderItem> salesOrderItemList = (List) JSONArray.toCollection(jsonArray, SalesOrderItem.class);
|
|
@@ -172,31 +174,19 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
|
|
|
}
|
|
|
|
|
|
// 代签收 - > 已签收 需要入库到售后仓库
|
|
|
- if(msg == 1 || msg == 3){
|
|
|
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ if(msg==1 || msg == 3){
|
|
|
List<SignclosedProductInfo> signclosedProductInfoList = complaintSignclosedProductInfoMapper.listSignclosedById(signclosedId);
|
|
|
for (SignclosedProductInfo spi:signclosedProductInfoList) {
|
|
|
- InventoryInfo info = inventoryMapper.getByInventoryByBar(spi.getColorBar(),2);
|
|
|
- info.setInventoryDefectiveProductNum(info.getInventoryDefectiveProductNum()+spi.getProductNum());
|
|
|
- info.setInventoryRecentRecord(sdf.format(new Date())+"不良品入库:"+ spi.getProductNum() + "件");
|
|
|
- flag = inventoryMapper.updateById(info);
|
|
|
- if(flag < 1){
|
|
|
- throw new RuntimeException("更新库存失败,更新库存失败。");
|
|
|
- }
|
|
|
-
|
|
|
- //添加日志
|
|
|
- InventoryLog inventoryLog = new InventoryLog();
|
|
|
- inventoryLog.setLogProductName(info.getInventoryProductName());
|
|
|
- inventoryLog.setLogProductBar(info.getInventoryProductBar());
|
|
|
- inventoryLog.setLogRemainingNum(spi.getProductNum());
|
|
|
- inventoryLog.setLogType(3);
|
|
|
- inventoryLog.setLogOperationType(1);
|
|
|
- inventoryLog.setLogDesc(sdf.format(new Date())+"不良品入库:"+spi.getProductNum()+"件");
|
|
|
- inventoryLog.setLogQualityType(2);
|
|
|
- inventoryLog.setLogWarehouseId(2); //售后仓库
|
|
|
- flag = inventoryLogMapper.insert(inventoryLog);
|
|
|
+ //增加售后仓库的良品
|
|
|
+ InventoryInfo inventoryInfo2 = new InventoryInfo();
|
|
|
+ inventoryInfo2.setInventoryDefectiveProductNum(spi.getProductNum());
|
|
|
+ inventoryInfo2.setInventoryProductBar(spi.getColorBar());
|
|
|
+ inventoryInfo2.setWarehouseId(2);
|
|
|
+ inventoryInfo2.setLogType(3); //售后签收,都是次品
|
|
|
+ inventoryInfo2.setInventoryRecentRecord("售后签收产品(签收ID:"+spi.getSignclosedId()+")");
|
|
|
+ flag = inventoryService.addInventory(inventoryInfo2);
|
|
|
if(flag < 1){
|
|
|
- throw new RuntimeException("更新库存失败,增加库存记录失败。");
|
|
|
+ throw new RuntimeException("签收失败,更新库存失败。");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -614,35 +604,50 @@ public class ComplaintSignclosedInfoServiceImpl implements ComplaintSignclosedIn
|
|
|
sendbackInfo.setSendbackSignTime(signclosedInfo.getSignclosedDate());
|
|
|
customerInfoMapper.updateSendbackInfo(sendbackInfo);
|
|
|
|
|
|
-
|
|
|
- // 代签收 - > 已签收 需要入库到售后仓库
|
|
|
Integer flag = 0;
|
|
|
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ // 代签收 - > 已签收 需要入库到售后仓库
|
|
|
List<SignclosedProductInfo> signclosedProductInfoList = complaintSignclosedProductInfoMapper.listSignclosedById(record.getSignclosedId());
|
|
|
for (SignclosedProductInfo spi:signclosedProductInfoList) {
|
|
|
- InventoryInfo info = inventoryMapper.getByInventoryByBar(spi.getColorBar(),2);
|
|
|
- info.setInventoryDefectiveProductNum(info.getInventoryDefectiveProductNum()+spi.getProductNum());
|
|
|
- info.setInventoryRecentRecord(sdf.format(new Date())+"不良品入库:"+ spi.getProductNum() + "件");
|
|
|
- flag = inventoryMapper.updateById(info);
|
|
|
+ //增加售后仓库的良品
|
|
|
+ InventoryInfo inventoryInfo2 = new InventoryInfo();
|
|
|
+ inventoryInfo2.setInventoryDefectiveProductNum(spi.getProductNum());
|
|
|
+ inventoryInfo2.setInventoryProductBar(spi.getColorBar());
|
|
|
+ inventoryInfo2.setWarehouseId(2);
|
|
|
+ inventoryInfo2.setLogType(3); //售后签收,都是次品
|
|
|
+ inventoryInfo2.setInventoryRecentRecord("售后签收产品(签收ID:"+spi.getSignclosedId()+")");
|
|
|
+ flag = inventoryService.addInventory(inventoryInfo2);
|
|
|
if(flag < 1){
|
|
|
- throw new RuntimeException("更新库存失败,更新库存失败。");
|
|
|
- }
|
|
|
- //添加日志
|
|
|
- InventoryLog inventoryLog = new InventoryLog();
|
|
|
- inventoryLog.setLogProductName(info.getInventoryProductName());
|
|
|
- inventoryLog.setLogProductBar(info.getInventoryProductBar());
|
|
|
- inventoryLog.setLogRemainingNum(spi.getProductNum());
|
|
|
- inventoryLog.setLogType(3);
|
|
|
- inventoryLog.setLogOperationType(1);
|
|
|
- inventoryLog.setLogDesc(sdf.format(new Date())+"不良品入库:"+spi.getProductNum()+"件");
|
|
|
- inventoryLog.setLogQualityType(2);
|
|
|
- inventoryLog.setLogWarehouseId(2); //售后仓库
|
|
|
- flag = inventoryLogMapper.insert(inventoryLog);
|
|
|
- if(flag < 1){
|
|
|
- throw new RuntimeException("更新库存失败,增加库存记录失败。");
|
|
|
+ throw new RuntimeException("签收失败,更新库存失败。");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 代签收 - > 已签收 需要入库到售后仓库
|
|
|
+// Integer flag = 0;
|
|
|
+// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+// List<SignclosedProductInfo> signclosedProductInfoList = complaintSignclosedProductInfoMapper.listSignclosedById(record.getSignclosedId());
|
|
|
+// for (SignclosedProductInfo spi:signclosedProductInfoList) {
|
|
|
+// InventoryInfo info = inventoryMapper.getByInventoryByBar(spi.getColorBar(),2);
|
|
|
+// info.setInventoryDefectiveProductNum(info.getInventoryDefectiveProductNum()+spi.getProductNum());
|
|
|
+// info.setInventoryRecentRecord(sdf.format(new Date())+"不良品入库:"+ spi.getProductNum() + "件");
|
|
|
+// flag = inventoryMapper.updateById(info);
|
|
|
+// if(flag < 1){
|
|
|
+// throw new RuntimeException("更新库存失败,更新库存失败。");
|
|
|
+// }
|
|
|
+// //添加日志
|
|
|
+// InventoryLog inventoryLog = new InventoryLog();
|
|
|
+// inventoryLog.setLogProductName(info.getInventoryProductName());
|
|
|
+// inventoryLog.setLogProductBar(info.getInventoryProductBar());
|
|
|
+// inventoryLog.setLogRemainingNum(spi.getProductNum());
|
|
|
+// inventoryLog.setLogType(3);
|
|
|
+// inventoryLog.setLogOperationType(1);
|
|
|
+// inventoryLog.setLogDesc(sdf.format(new Date())+"不良品入库:"+spi.getProductNum()+"件");
|
|
|
+// inventoryLog.setLogQualityType(2);
|
|
|
+// inventoryLog.setLogWarehouseId(2); //售后仓库
|
|
|
+// flag = inventoryLogMapper.insert(inventoryLog);
|
|
|
+// if(flag < 1){
|
|
|
+// throw new RuntimeException("更新库存失败,增加库存记录失败。");
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
//关联客诉/判断是否生成客诉信息
|
|
|
try {
|