yxt_djz 3 years ago
parent
commit
2aecf30537
  1. 116
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/inventoryinformation/InventoryInformationService.java
  2. 2
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java
  3. 2
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/storein/StoreInService.java
  4. 2
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/storeout/StoreOutService.java
  5. 15
      yxt_supervise/supervise-portal/supervise-portal-biz/src/test/java/com/yxt/supervise/portal/test/controller/ArithmeticController.java

116
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/inventoryinformation/InventoryInformationService.java

@ -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);
}
}
}

2
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/salesdata/SalesDataService.java

@ -257,7 +257,7 @@ public class SalesDataService extends MybatisBaseService<SalesDataMapper, SalesD
lisss.add(rowNum+"");
baseMapper.insert(sd);
inventoryInformationService.reduceStock(sd.getProCode(),sd.getStoreCode(),sd.getSaleNum());
inventoryInformationService.reduceStock(sd.getProCode(),sd.getProName(),sd.getStoreCode(),sd.getSaleNum());
log.info("productInformation:{}", JSONObject.toJSONString(sd));
}
String x = JSON.toJSONString(lisss);

2
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/storein/StoreInService.java

@ -63,7 +63,7 @@ private InventoryInformationService inventoryInformationService;
map.put(c_f, dto);
}
StoreInItem item = createStoreInItemFromRow(row);
inventoryInformationService.increaseStock(item.getProductCode(),
inventoryInformationService.increaseStock(item.getProductCode(),item.getProductName(),
dto.getStoreIn().getStoreCode(),item.getInNumber()+"");
dto.getItemList().add(item);
}

2
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/storeout/StoreOutService.java

@ -92,7 +92,7 @@ public class StoreOutService extends MybatisBaseService<StoreOutMapper, StoreOut
StoreOutItem item = createStoreOutItemFromRow(row);
String storeCode = dto.getStoreOut().getStoreCode();// 仓库/门店编号
String productCode = item.getProductCode();
inventoryInformationService.increaseStock(productCode,
inventoryInformationService.reduceStock(productCode,item.getProductName(),
storeCode,item.getOutNumber()+"");
dto.getItemList().add(item);
}

15
yxt_supervise/supervise-portal/supervise-portal-biz/src/test/java/com/yxt/supervise/portal/test/controller/ArithmeticController.java

@ -19,18 +19,9 @@ import java.util.Map;
public class ArithmeticController {
public static void main(String[] args) {
System.out.println("======get5");
get5(30000, 0.02, 3);
System.out.println("======get4");
get4(30000, 0.02, 3);
System.out.println("======get3");
get3(30000, 0.02, 3);
System.out.println("=======get2");
get2(30000, 0.02, 3);
System.out.println("=======get1");
// get1(30000, 0.02, 3);
System.out.println("========get");
get(30000, 0.02, 3);
String str="12345678";
String substring = str.substring(0, str.length() - 2);
System.out.println(substring);
}
/**

Loading…
Cancel
Save