|
|
@@ -30,9 +30,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author: guq
|
|
|
@@ -462,6 +460,13 @@ public class SaleServiceImpl implements SaleService{
|
|
|
prodIODetail.setCompanyId(companyId);
|
|
|
//本次转单数
|
|
|
prodIODetail.setPd_outqty(saleDetail.getSd_qty() - saleDetail.getSd_yqty());
|
|
|
+ //获取物料默认仓库
|
|
|
+ Map<String, Object> warehouse = getWareHouseByCode(saleDetail.getSd_prodcode());
|
|
|
+ if (null != warehouse) {
|
|
|
+ prodIODetail.setPd_whid(warehouse.get("pr_whid") == null ? 0 : Integer.valueOf(warehouse.get("pr_whid").toString()));
|
|
|
+ prodIODetail.setPd_whcode(String.valueOf(warehouse.get("pr_whcode")));
|
|
|
+ prodIODetail.setPd_whname(String.valueOf(warehouse.get("pr_whname")));
|
|
|
+ }
|
|
|
prodIODetailMapper.insertSelective(prodIODetail);
|
|
|
//更新已转数
|
|
|
saleDetail.setSd_yqty(saleDetail.getSd_qty());
|
|
|
@@ -573,4 +578,16 @@ public class SaleServiceImpl implements SaleService{
|
|
|
return baseDTO;
|
|
|
}
|
|
|
|
|
|
+ private Map<String, Object> getWareHouseByCode(String code) {
|
|
|
+ if (StringUtils.isEmpty(code)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Long companyId = BaseContextHolder.getCompanyId();
|
|
|
+ List<HashMap<String, Object>> list = prodInOutMapper.getWareHouseByCode(code, companyId);
|
|
|
+ if (null != list) {
|
|
|
+ return list.get(0);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|