|
|
@@ -2,6 +2,7 @@ package com.usoftchina.saas.document.service.impl;
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.usoftchina.saas.base.Result;
|
|
|
import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
|
|
|
import com.usoftchina.saas.commons.api.MaxnumberService;
|
|
|
import com.usoftchina.saas.commons.api.MessageLogService;
|
|
|
@@ -123,8 +124,9 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
//找到原始单据,反过账并删除
|
|
|
String inoutCode = getMapper().selectProdIOCode(product.getPr_code(), BaseContextHolder.getCompanyId(), "库存初始化");
|
|
|
post(inoutCode, "反过账");
|
|
|
- getMapper().deleteProdIOByCode(inoutCode, BaseContextHolder.getCompanyId());
|
|
|
getMapper().deleteProdIODetailByCode(inoutCode, BaseContextHolder.getCompanyId());
|
|
|
+ getMapper().deleteProdIOByCode(inoutCode, BaseContextHolder.getCompanyId());
|
|
|
+
|
|
|
//此种情况不可能发生明细行数量,只会发生明细行数据修改/新增明细行
|
|
|
//a.更新明细行数据
|
|
|
List<ProductDetail> insertItems = new ArrayList<ProductDetail>();
|
|
|
@@ -226,7 +228,7 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
List<ProdIODetail> insertItems = new ArrayList<ProdIODetail>();
|
|
|
//生成库存初始化单据明细表
|
|
|
for(ProductDetail productDetail : productDetailList){
|
|
|
- ProdIODetail prodIODetail = generateProdIODetail(product, productDetail);
|
|
|
+ ProdIODetail prodIODetail = generateProdIODetail(product, productDetail, inoutCode, pi_id);
|
|
|
insertItems.add(prodIODetail);
|
|
|
}
|
|
|
//明细插入
|
|
|
@@ -253,7 +255,7 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
}else if ("反过账".equals(type)){
|
|
|
warehouseService.unPost(map);
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(map.get("result"))){
|
|
|
+ if (!StringUtils.isEmpty(map.get("result"))){
|
|
|
throw new BizException(76203, map.get("result").toString());
|
|
|
}
|
|
|
}
|
|
|
@@ -264,11 +266,11 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
* @param productDetail
|
|
|
* @return
|
|
|
*/
|
|
|
- private ProdIODetail generateProdIODetail(Product product, ProductDetail productDetail){
|
|
|
+ private ProdIODetail generateProdIODetail(Product product, ProductDetail productDetail, String inoutCode, Long pi_id){
|
|
|
ProdIODetail prodIODetail = new ProdIODetail();
|
|
|
prodIODetail.setPd_piclass("库存初始化");
|
|
|
- prodIODetail.setPd_inoutno(product.getPr_code());
|
|
|
- prodIODetail.setPd_piid(product.getId());
|
|
|
+ prodIODetail.setPd_inoutno(inoutCode);
|
|
|
+ prodIODetail.setPd_piid(pi_id);
|
|
|
prodIODetail.setPd_pdno(productDetail.getPd_detno());
|
|
|
prodIODetail.setPd_ordercode(product.getPr_code()); //订单号 -> 物料编号
|
|
|
prodIODetail.setPd_orderdetno(productDetail.getPd_detno()); //订单序号 -> 物料明细序号
|
|
|
@@ -343,7 +345,8 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
try{
|
|
|
close(docBaseDTO.getId());
|
|
|
}catch (Exception e){
|
|
|
- errorMsg.append("编号:" + docBaseDTO.getCode() + "处理失败," + e.getMessage());
|
|
|
+ String msg = BizExceptionCode.DEAL_FAILED.getMessage();
|
|
|
+ errorMsg.append(String.format(msg, docBaseDTO.getCode(), e.getMessage()));
|
|
|
}
|
|
|
}
|
|
|
return errorMsg.toString();
|
|
|
@@ -356,7 +359,8 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
try{
|
|
|
open(docBaseDTO.getId());
|
|
|
}catch (Exception e){
|
|
|
- errorMsg.append("编号:" + docBaseDTO.getCode() + "处理失败," + e.getMessage());
|
|
|
+ String msg = BizExceptionCode.DEAL_FAILED.getMessage();
|
|
|
+ errorMsg.append(String.format(msg, docBaseDTO.getCode(), e.getMessage()));
|
|
|
}
|
|
|
}
|
|
|
return errorMsg.toString();
|
|
|
@@ -477,8 +481,8 @@ public class ProductServiceImpl extends CommonBaseServiceImpl<ProductMapper, Pro
|
|
|
String inoutCode = getMapper().selectProdIOCode(prCode, BaseContextHolder.getCompanyId(), "库存初始化");
|
|
|
if (!StringUtils.isEmpty(inoutCode)) {
|
|
|
post(inoutCode, "反过账");
|
|
|
- getMapper().deleteProdIOByCode(inoutCode, BaseContextHolder.getCompanyId());
|
|
|
getMapper().deleteProdIODetailByCode(inoutCode, BaseContextHolder.getCompanyId());
|
|
|
+ getMapper().deleteProdIOByCode(inoutCode, BaseContextHolder.getCompanyId());
|
|
|
}
|
|
|
|
|
|
productDetailMapper.deleteByPrimaryKey(id);
|