录入采购、销售、零售单据的时候自动更新对应商品的价格
This commit is contained in:
parent
a3e58fe757
commit
d52dc4d06e
@ -587,6 +587,8 @@ public class DepotItemService {
|
||||
this.insertDepotItemWithObj(depotItem);
|
||||
//更新当前库存
|
||||
updateCurrentStock(depotItem);
|
||||
//更新商品的价格
|
||||
updateMaterialExtendPrice(materialExtend.getId(), depotHead.getSubType(), rowObj);
|
||||
}
|
||||
//如果关联单据号非空则更新订单的状态,单据类型:采购入库单或销售出库单或盘点复盘单
|
||||
if(BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
|
||||
@ -734,6 +736,31 @@ public class DepotItemService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品的价格
|
||||
* @param meId
|
||||
* @param subType
|
||||
* @param rowObj
|
||||
*/
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public void updateMaterialExtendPrice(Long meId, String subType, JSONObject rowObj) throws Exception {
|
||||
if (StringUtil.isExist(rowObj.get("unitPrice"))) {
|
||||
BigDecimal unitPrice = rowObj.getBigDecimal("unitPrice");
|
||||
MaterialExtend materialExtend = new MaterialExtend();
|
||||
materialExtend.setId(meId);
|
||||
if(BusinessConstants.SUB_TYPE_PURCHASE.equals(subType)) {
|
||||
materialExtend.setPurchaseDecimal(unitPrice);
|
||||
}
|
||||
if(BusinessConstants.SUB_TYPE_SALES.equals(subType)) {
|
||||
materialExtend.setWholesaleDecimal(unitPrice);
|
||||
}
|
||||
if(BusinessConstants.SUB_TYPE_RETAIL.equals(subType)) {
|
||||
materialExtend.setCommodityDecimal(unitPrice);
|
||||
}
|
||||
materialExtendService.updateMaterialExtend(materialExtend);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public List<DepotItemStockWarningCount> findStockWarningCount(Integer offset, Integer rows, String materialParam, List<Long> depotList) {
|
||||
List<DepotItemStockWarningCount> list = null;
|
||||
|
||||
@ -312,7 +312,7 @@ public class MaterialExtendService {
|
||||
MaterialExtend materialExtend = JSONObject.parseObject(obj.toJSONString(), MaterialExtend.class);
|
||||
int result=0;
|
||||
try{
|
||||
result = materialExtendMapper.insertSelective(materialExtend);
|
||||
result = materialExtendMapper.updateByPrimaryKeySelective(materialExtend);
|
||||
}catch(Exception e){
|
||||
JshException.writeFail(logger, e);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user