|
@@ -2,6 +2,7 @@ package com.jsh.erp.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.jsh.erp.constants.BusinessConstants;
|
|
|
import com.jsh.erp.constants.ExceptionConstants;
|
|
@@ -75,6 +76,9 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
|
|
|
@Resource
|
|
|
private MaterialExtendMapper materialExtendMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private SyncTescoSystemService syncTescoSystemService;
|
|
|
+
|
|
|
/**
|
|
|
* pda根据订单信息查询商品列表
|
|
|
* @return
|
|
@@ -260,6 +264,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
|
|
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
|
|
public int insertDepotItemWithObj(DepotItem depotItem)throws Exception {
|
|
|
User user = userService.getCurrentUser();
|
|
|
+ depotItem.setCreateTime(new Date());
|
|
|
depotItem.setTenantId(user.getId());
|
|
|
int result =0;
|
|
|
try{
|
|
@@ -597,7 +602,8 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
|
|
|
depotItem.setOperNumber(rowObj.getBigDecimal("operNumber"));
|
|
|
//获取子表单商品单位
|
|
|
String unit = rowObj.get("unit") == null ? "" :rowObj.get("unit").toString();
|
|
|
- BigDecimal oNumber = rowObj.getBigDecimal("operNumber");
|
|
|
+ //获取实际出入库数量
|
|
|
+ BigDecimal oNumber = rowObj.getBigDecimal("actualQuantityInStorage");
|
|
|
if (StringUtil.isNotEmpty(unitInfo.getName())) {
|
|
|
String basicUnit = unitInfo.getBasicUnit(); //基本单位
|
|
|
if (unit.equals(basicUnit)) { //如果等于基本单位
|
|
@@ -680,11 +686,18 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
|
|
|
depotItem.setPurchaseUnitPrice(getDepotItemByBatchNumber(depotItem.getMaterialExtendId(),depotItem.getBatchNumber()).getUnitPrice());
|
|
|
}
|
|
|
}
|
|
|
+ //含税单价
|
|
|
if (StringUtil.isExist(rowObj.get("taxUnitPrice"))) {
|
|
|
depotItem.setTaxUnitPrice(rowObj.getBigDecimal("taxUnitPrice"));
|
|
|
}
|
|
|
+ //总金额,不含税
|
|
|
if (StringUtil.isExist(rowObj.get("allPrice"))) {
|
|
|
- depotItem.setAllPrice(rowObj.getBigDecimal("allPrice"));
|
|
|
+ if (depotItem.getActualQuantityInStorage() == null || depotItem.getActualQuantityInStorage().equals(BigDecimal.ZERO)){
|
|
|
+ depotItem.setAllPrice(rowObj.getBigDecimal("allPrice"));
|
|
|
+ }else {
|
|
|
+ //基本单位数量*单价
|
|
|
+ depotItem.setAllPrice(depotItem.getBasicNumber().multiply(depotItem.getUnitPrice()));
|
|
|
+ }
|
|
|
}
|
|
|
if (StringUtil.isExist(rowObj.get("depotId"))) {
|
|
|
depotItem.setDepotId(rowObj.getLong("depotId"));
|
|
@@ -709,14 +722,24 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
|
|
|
String.format(ExceptionConstants.DEPOT_HEAD_ANOTHER_DEPOT_FAILED_MSG));
|
|
|
}
|
|
|
}
|
|
|
+ //税率
|
|
|
if (StringUtil.isExist(rowObj.get("taxRate"))) {
|
|
|
depotItem.setTaxRate(rowObj.getBigDecimal("taxRate"));
|
|
|
}
|
|
|
+ //税额
|
|
|
if (StringUtil.isExist(rowObj.get("taxMoney"))) {
|
|
|
- depotItem.setTaxMoney(rowObj.getBigDecimal("taxMoney"));
|
|
|
+ if (depotItem.getActualQuantityInStorage() == null || depotItem.getActualQuantityInStorage().equals(BigDecimal.ZERO)){
|
|
|
+ depotItem.setTaxMoney(rowObj.getBigDecimal("taxMoney"));
|
|
|
+ }else {
|
|
|
+ //单价总金额*税率
|
|
|
+ depotItem.setTaxMoney(depotItem.getAllPrice().multiply(depotItem.getTaxRate()));
|
|
|
+ }
|
|
|
}
|
|
|
+ //价税合计
|
|
|
if (StringUtil.isExist(rowObj.get("taxLastMoney"))) {
|
|
|
- depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
|
|
|
+ //单价总额 + 税额
|
|
|
+ depotItem.setTaxLastMoney(depotItem.getAllPrice().add(depotItem.getTaxMoney()));
|
|
|
+ //depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
|
|
|
}
|
|
|
if (StringUtil.isExist(rowObj.get("mType"))) {
|
|
|
depotItem.setMaterialType(rowObj.getString("mType"));
|
|
@@ -1328,6 +1351,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
|
|
|
//当前库存信息不存在,新增当前库存信息
|
|
|
materialCurrentStockMapper.insertSelective(materialCurrentStock);
|
|
|
// }
|
|
|
+ syncTescoSystemService.sycnTescoStock(mId);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1647,4 +1671,15 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
|
|
|
return materialOther;
|
|
|
}
|
|
|
|
|
|
+ //删除前回复库存
|
|
|
+ private void ReplyInventoryByHeadId(Long id) throws Exception {
|
|
|
+ DepotHead depotHead = depotHeadService.getDepotHead(id);
|
|
|
+ List<DepotItem> list = getListByHeaderId(id);
|
|
|
+ for (DepotItem depotItem : list) {
|
|
|
+ if (depotHead.getType().equals("入库")){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|