|
|
@ -33,12 +33,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.supervise.portal.api.dictcommon.DictCommon; |
|
|
|
import com.yxt.supervise.portal.api.dictcommon.DictCommonDetailsVo; |
|
|
|
import com.yxt.supervise.portal.api.inventoryinformation.*; |
|
|
|
import com.yxt.supervise.portal.api.productinformation.ProductInformation; |
|
|
|
import com.yxt.supervise.portal.api.productinformation.ProductInformationVo; |
|
|
|
import com.yxt.supervise.portal.api.productnum.ProductNum; |
|
|
|
import com.yxt.supervise.portal.api.purchaserequisitionpro.PurchaseRequisitionPro; |
|
|
|
import com.yxt.supervise.portal.biz.dictcommon.DictCommonService; |
|
|
|
import com.yxt.supervise.portal.biz.productinformation.ProductInformationService; |
|
|
|
import com.yxt.supervise.portal.biz.productnum.ProductNumService; |
|
|
|
import io.swagger.annotations.ApiModelProperty; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
@ -315,13 +317,13 @@ public class InventoryInformationService extends MybatisBaseService<InventoryInf |
|
|
|
* @param store 门店的代码 |
|
|
|
* @param number 商品数量 |
|
|
|
*/ |
|
|
|
public void increaseStock(String proCode,String store,String number ){ |
|
|
|
ProductInformationVo productInformationVo = productInformationService.selectByCode(proCode); |
|
|
|
String newestPurchasePrice = productInformationVo.getNewestPurchasePrice(); |
|
|
|
public void increaseStock(String proCode,String proName,String store,String number ){ |
|
|
|
//ProductInformationVo productInformationVo = productInformationService.selectByCode(proCode);
|
|
|
|
//String newestPurchasePrice = productInformationVo.getNewestPurchasePrice();
|
|
|
|
/*BigDecimal bigDecimal = new BigDecimal(newestPurchasePrice); |
|
|
|
BigDecimal bigDecimal1 = new BigDecimal(number); |
|
|
|
BigDecimal multiply = bigDecimal.multiply(bigDecimal1);*/ |
|
|
|
increaseStock( proCode, store, number, "0"); |
|
|
|
increaseStock( proCode,proName ,store, number, "0"); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 增加库存 |
|
|
@ -330,8 +332,43 @@ public class InventoryInformationService extends MybatisBaseService<InventoryInf |
|
|
|
* @param number 商品数量 |
|
|
|
* @param money 金额 |
|
|
|
*/ |
|
|
|
private void increaseStock(String proCode,String store,String number,String money){ |
|
|
|
private void increaseStock(String proCode,String proName,String store,String number,String money){ |
|
|
|
InventoryInformation ii=baseMapper.selectByProCodeAndStoreCode(proCode,store); |
|
|
|
if(ii==null){ |
|
|
|
ProductInformationVo productInformationVo = productInformationService.selectByCode(proCode); |
|
|
|
if(productInformationVo==null){ |
|
|
|
ProductInformation productInformation = new ProductInformation(); |
|
|
|
productInformation.setNewestPurchasePrice("0"); |
|
|
|
productInformation.setCode(proCode); |
|
|
|
String substring = proCode.substring(0, proCode.length() - 2); |
|
|
|
DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(substring, "category"); |
|
|
|
if(category==null){ |
|
|
|
DictCommon dictCommon = new DictCommon(); |
|
|
|
dictCommon.setDictType("category"); |
|
|
|
dictCommon.setDictKey(substring); |
|
|
|
dictCommon.setDictValue(""); |
|
|
|
dictCommonService.insert(dictCommon); |
|
|
|
} |
|
|
|
productInformation.setCategoryKey(substring); |
|
|
|
productInformation.setCategory(""); |
|
|
|
productInformationService.insert(productInformation); |
|
|
|
} |
|
|
|
ii=new InventoryInformation(); |
|
|
|
ii.setWarehouseCode(store); // 仓库编码
|
|
|
|
ii.setWarehouseName(store); // 仓库名称
|
|
|
|
ii.setProdCode(proCode); // 商品编码
|
|
|
|
ii.setProdBarCode(""); // 商品条码
|
|
|
|
ii.setProdName(proName); // 商品名称
|
|
|
|
ii.setWarehouseType(""); // 仓库类型
|
|
|
|
ii.setProdNum(number); // 商品数量
|
|
|
|
ii.setProdValue(""); // 商品货值
|
|
|
|
ii.setSuppliderSid(""); // 供应商
|
|
|
|
ii.setSuppliderName(""); // 供应商
|
|
|
|
ii.setNewInventory(number);//新的库存数 根据入库单 出库单、销售数据进行维护的
|
|
|
|
ii.setNewValue("");//新的货值 根据入库单 出库单、销售数据进行维护的
|
|
|
|
ii.setDeviations("");//偏差数量 维护盘库后与系统中偏差的数值
|
|
|
|
baseMapper.insert(ii); |
|
|
|
}else{ |
|
|
|
String newInventory = ii.getNewInventory();//新的库存数
|
|
|
|
String newValue = ii.getNewValue();//新的货值
|
|
|
|
ii.getDeviations();//偏差值
|
|
|
@ -343,7 +380,7 @@ public class InventoryInformationService extends MybatisBaseService<InventoryInf |
|
|
|
BigDecimal bigDecimal1 = new BigDecimal(money); |
|
|
|
BigDecimal add = bigDecimal.add(bigDecimal1); |
|
|
|
ii.setNewValue(add.toString());*/ |
|
|
|
baseMapper.updateById(ii); |
|
|
|
baseMapper.updateById(ii);} |
|
|
|
} |
|
|
|
/** |
|
|
|
* 减少库存 |
|
|
@ -351,13 +388,13 @@ public class InventoryInformationService extends MybatisBaseService<InventoryInf |
|
|
|
* @param store 门店的代码 |
|
|
|
* @param number 商品数量 |
|
|
|
*/ |
|
|
|
public void reduceStock(String proCode,String store,String number){ |
|
|
|
ProductInformationVo productInformationVo = productInformationService.selectByCode(proCode); |
|
|
|
String newestPurchasePrice = productInformationVo.getNewestPurchasePrice(); |
|
|
|
public void reduceStock(String proCode,String proName,String store,String number){ |
|
|
|
//ProductInformationVo productInformationVo = productInformationService.selectByCode(proCode);
|
|
|
|
//String newestPurchasePrice = productInformationVo.getNewestPurchasePrice();
|
|
|
|
/*BigDecimal bigDecimal = new BigDecimal(newestPurchasePrice); |
|
|
|
BigDecimal bigDecimal1 = new BigDecimal(number); |
|
|
|
BigDecimal multiply = bigDecimal.multiply(bigDecimal1);*/ |
|
|
|
reduceStock( proCode, store, number, "0"); |
|
|
|
reduceStock( proCode,proName, store, number, "0"); |
|
|
|
} |
|
|
|
/** |
|
|
|
* 减少库存 |
|
|
@ -366,19 +403,60 @@ public class InventoryInformationService extends MybatisBaseService<InventoryInf |
|
|
|
* @param number 商品数量 |
|
|
|
* @param money 金额 |
|
|
|
*/ |
|
|
|
private void reduceStock(String proCode,String store,String number,String money){ |
|
|
|
private void reduceStock(String proCode,String proName,String store,String number,String money){ |
|
|
|
InventoryInformation ii=baseMapper.selectByProCodeAndStoreCode(proCode,store); |
|
|
|
String newInventory = ii.getNewInventory();//新的库存数
|
|
|
|
String newValue = ii.getNewValue();//新的货值
|
|
|
|
ii.getDeviations();//偏差值
|
|
|
|
Integer integer = Integer.valueOf(newInventory); |
|
|
|
Integer integer1 = Integer.valueOf(number); |
|
|
|
integer=integer-integer1; |
|
|
|
ii.setNewInventory(integer.toString()); |
|
|
|
|
|
|
|
if(ii==null){ |
|
|
|
ProductInformationVo productInformationVo = productInformationService.selectByCode(proCode); |
|
|
|
if(productInformationVo==null){ |
|
|
|
ProductInformation productInformation = new ProductInformation(); |
|
|
|
productInformation.setNewestPurchasePrice("0"); |
|
|
|
productInformation.setCode(proCode); |
|
|
|
String substring = proCode.substring(0, proCode.length() - 2); |
|
|
|
DictCommonDetailsVo category = dictCommonService.fetchByKeyAndType(substring, "category"); |
|
|
|
if(category==null){ |
|
|
|
DictCommon dictCommon = new DictCommon(); |
|
|
|
dictCommon.setDictType("category"); |
|
|
|
dictCommon.setDictKey(substring); |
|
|
|
dictCommon.setDictValue(""); |
|
|
|
|
|
|
|
dictCommonService.insert(dictCommon); |
|
|
|
} |
|
|
|
productInformation.setCategoryKey(substring); |
|
|
|
productInformation.setCategory(""); |
|
|
|
|
|
|
|
//BeanUtil.copyProperties(productInformationVo,productInformation);
|
|
|
|
productInformationService.insert(productInformation); |
|
|
|
|
|
|
|
} |
|
|
|
ii=new InventoryInformation(); |
|
|
|
ii.setWarehouseCode(store); // 仓库编码
|
|
|
|
ii.setWarehouseName(store); // 仓库名称
|
|
|
|
ii.setProdCode(proCode); // 商品编码
|
|
|
|
ii.setProdBarCode(""); // 商品条码
|
|
|
|
ii.setProdName(proName); // 商品名称
|
|
|
|
ii.setWarehouseType(""); // 仓库类型
|
|
|
|
ii.setProdNum("-"+number); // 商品数量
|
|
|
|
ii.setProdValue(""); // 商品货值
|
|
|
|
ii.setSuppliderSid(""); // 供应商
|
|
|
|
ii.setSuppliderName(""); // 供应商
|
|
|
|
ii.setNewInventory("-"+number);//新的库存数 根据入库单 出库单、销售数据进行维护的
|
|
|
|
ii.setNewValue("");//新的货值 根据入库单 出库单、销售数据进行维护的
|
|
|
|
ii.setDeviations("");//偏差数量 维护盘库后与系统中偏差的数值
|
|
|
|
baseMapper.insert(ii); |
|
|
|
}else { |
|
|
|
String newInventory = ii.getNewInventory();//新的库存数
|
|
|
|
String newValue = ii.getNewValue();//新的货值
|
|
|
|
ii.getDeviations();//偏差值
|
|
|
|
Integer integer = Integer.valueOf(newInventory); |
|
|
|
Integer integer1 = Integer.valueOf(number); |
|
|
|
integer = integer - integer1; |
|
|
|
ii.setNewInventory(integer.toString()); |
|
|
|
/*BigDecimal bigDecimal = new BigDecimal(newValue); |
|
|
|
BigDecimal bigDecimal1 = new BigDecimal(money); |
|
|
|
BigDecimal subtract = bigDecimal.subtract(bigDecimal1); |
|
|
|
ii.setNewValue(subtract.toString());*/ |
|
|
|
baseMapper.updateById(ii); |
|
|
|
baseMapper.updateById(ii); |
|
|
|
} |
|
|
|
} |
|
|
|
} |