|
@@ -46,6 +46,8 @@ import java.util.*;
|
|
|
public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehouseInOutInfoMapper, SpeedWarehouseInOutInfo> implements ISpeedWarehouseInOutInfoService {
|
|
|
@Autowired
|
|
|
private ISpeedGoodsInfoService speedGoodsInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ISpeedCustomerInfoService speedCustomerInfoService;
|
|
|
@Value("${file-root-path}")
|
|
|
private String localPath;
|
|
|
@Override
|
|
@@ -122,12 +124,12 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
.eq("comp_id",speedWarehouseInOutInfo.getCompId())
|
|
|
.eq("goods_name",speedWarehouseInOutInfo.getGoodsName()));
|
|
|
if (speedGoodsInfo!=null){
|
|
|
- //粮款不为空时计算新加权成本
|
|
|
- if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
- //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
- speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
- /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
- }
|
|
|
+// //粮款不为空时计算新加权成本
|
|
|
+// if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
+// //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
+// speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
+// /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
+// }
|
|
|
speedGoodsInfo.setStorage(speedGoodsInfo.getStorage()-speedWarehouseInOutInfo.getNetWeight());
|
|
|
speedGoodsInfoService.updateById(speedGoodsInfo);
|
|
|
}
|
|
@@ -144,12 +146,12 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
.eq("comp_id",speedWarehouseInOutInfo.getCompId())
|
|
|
.eq("goods_name",speedWarehouseInOutInfo.getGoodsName()));
|
|
|
if (speedGoodsInfo!=null){
|
|
|
- //粮款不为空时计算新加权成本
|
|
|
- if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
- //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
- speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
- /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
- }
|
|
|
+// //粮款不为空时计算新加权成本
|
|
|
+// if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
+// //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
+// speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
+// /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
+// }
|
|
|
speedGoodsInfo.setStorage(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight());
|
|
|
speedGoodsInfoService.updateById(speedGoodsInfo);
|
|
|
}
|
|
@@ -169,11 +171,11 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
.eq("goods_name",speedWarehouseInOutInfo.getGoodsName()));
|
|
|
if (speedGoodsInfo!=null){
|
|
|
//粮款不为空时计算新加权成本
|
|
|
- if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
- //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
- speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
- /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
- }
|
|
|
+// if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
+// //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
+// speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
+// /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
+// }
|
|
|
//加上原净重再减去新净重
|
|
|
speedGoodsInfo.setStorage(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo1.getNetWeight()-speedWarehouseInOutInfo.getNetWeight());
|
|
|
speedGoodsInfoService.updateById(speedGoodsInfo);
|
|
@@ -191,17 +193,23 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
.eq("goods_name",speedWarehouseInOutInfo.getGoodsName()));
|
|
|
if (speedGoodsInfo!=null){
|
|
|
//粮款不为空时计算新加权成本
|
|
|
- if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
- //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
- speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
- /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
- }
|
|
|
+// if (speedWarehouseInOutInfo.getGrainFund()!=null) {
|
|
|
+// //新成本=(原成本*原库存+本次粮款)/(原库存+本次净重)
|
|
|
+// speedGoodsInfo.setWeightedCost((speedGoodsInfo.getWeightedCost() * speedGoodsInfo.getStorage() +speedWarehouseInOutInfo.getGrainFund())
|
|
|
+// /(speedGoodsInfo.getStorage()+speedWarehouseInOutInfo.getNetWeight()));
|
|
|
+// }
|
|
|
//减去原净重再加上新净重
|
|
|
speedGoodsInfo.setStorage(speedGoodsInfo.getStorage()-speedWarehouseInOutInfo1.getNetWeight()+speedWarehouseInOutInfo.getNetWeight());
|
|
|
speedGoodsInfoService.updateById(speedGoodsInfo);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ this.updateById(speedWarehouseInOutInfo);
|
|
|
+ }
|
|
|
+ //更新被选择客户更新时间
|
|
|
+ SpeedCustomerInfo speedCustomerInfo=speedCustomerInfoService.selectById(speedWarehouseInOutInfo.getCustomerId());
|
|
|
+ if (speedCustomerInfo!=null){
|
|
|
+ speedCustomerInfoService.updateById(speedCustomerInfo);
|
|
|
}
|
|
|
return "ok";
|
|
|
}
|
|
@@ -209,6 +217,23 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
@Override
|
|
|
public void deleteInfo(String id) {
|
|
|
SpeedWarehouseInOutInfo speedWarehouseInOutInfo = this.selectById(id);
|
|
|
+ //净重不为空,操作库存
|
|
|
+ if (speedWarehouseInOutInfo.getNetWeight()!=null){
|
|
|
+ SpeedGoodsInfo speedGoodsInfo=speedGoodsInfoService.selectOne(new EntityWrapper<SpeedGoodsInfo>()
|
|
|
+ .eq("comp_id",speedWarehouseInOutInfo.getCompId())
|
|
|
+ .eq("goods_name",speedWarehouseInOutInfo.getGoodsName()));
|
|
|
+ if (speedGoodsInfo!=null){
|
|
|
+ //出库加库存
|
|
|
+ if ("1".equals(speedWarehouseInOutInfo.getInOutFlag())) {
|
|
|
+ speedGoodsInfo.setStorage(speedGoodsInfo.getStorage() + speedWarehouseInOutInfo.getNetWeight());
|
|
|
+ }
|
|
|
+ //入库减库存
|
|
|
+ else{
|
|
|
+ speedGoodsInfo.setStorage(speedGoodsInfo.getStorage() - speedWarehouseInOutInfo.getNetWeight());
|
|
|
+ }
|
|
|
+ speedGoodsInfoService.updateById(speedGoodsInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
this.deleteById(speedWarehouseInOutInfo.getId());
|
|
|
}
|
|
|
|
|
@@ -488,7 +513,8 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
sheet.setColumnWidth(12, 12 * 256 + 184);
|
|
|
sheet.setColumnWidth(13, 12 * 256 + 184);
|
|
|
sheet.setColumnWidth(14, "日期".getBytes().length*2*256);
|
|
|
- sheet.setColumnWidth(15, 1 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(15, 12 * 256 + 184);
|
|
|
+ sheet.setColumnWidth(16, 1 * 256 + 184);
|
|
|
|
|
|
// 创建单元格对象
|
|
|
HSSFCell cell = null;
|
|
@@ -538,6 +564,8 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
cell.setCellStyle(styleTitle);
|
|
|
cell = row0.createCell(14);
|
|
|
cell.setCellStyle(styleTitle);
|
|
|
+ cell = row0.createCell(15);
|
|
|
+ cell.setCellStyle(styleTitle);
|
|
|
rownum++;
|
|
|
|
|
|
|
|
@@ -584,6 +612,8 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
cell.setCellStyle(contextstyle1);
|
|
|
cell = rowp.createCell(14);
|
|
|
cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowp.createCell(15);
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
rownum++;
|
|
|
|
|
|
HSSFRow row1 = sheet.createRow((int) rownum);
|
|
@@ -630,6 +660,9 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
cell = row1.createCell(14);
|
|
|
cell.setCellValue("日期");
|
|
|
cell.setCellStyle(styleDetail);
|
|
|
+ cell = row1.createCell(15);
|
|
|
+ cell.setCellValue("收支状态");
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
rownum++;
|
|
|
|
|
|
|
|
@@ -691,6 +724,9 @@ public class SpeedWarehouseInOutInfoServiceImpl extends ServiceImpl<SpeedWarehou
|
|
|
String date = addDateOneDay(speedWarehouseInOutInfo1.getCreateDate() != null ? speedWarehouseInOutInfo1.getCreateDate() : new Date());
|
|
|
cell.setCellValue(date);
|
|
|
cell.setCellStyle(styleDetail);
|
|
|
+ cell = rowx.createCell(15);
|
|
|
+ cell.setCellValue(editString(speedWarehouseInOutInfo1.getStatus()));
|
|
|
+ cell.setCellStyle(styleDetail);
|
|
|
rownum++;
|
|
|
}
|
|
|
|