Browse Source

完成物料出库功能修改

lwx_dev
erdanergou 3 years ago
parent
commit
e5337b6007
  1. 18
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 4
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  3. 9
      src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  4. 4
      src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java
  5. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java
  6. 2
      src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java
  7. 119
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  8. 4
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  9. 1
      src/main/resources/templates/pages/depository/table-in.html
  10. 8
      src/main/resources/templates/pages/place/materialForPlace.html
  11. 9
      src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html
  12. 2
      src/test/java/com/dreamchaser/depository_manage/TestForOther.java
  13. 9
      target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml
  14. 1
      target/classes/templates/pages/depository/table-in.html
  15. 8
      target/classes/templates/pages/place/materialForPlace.html
  16. 9
      target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html

18
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -754,7 +755,7 @@ public class DepositoryRecordController {
simpleApplicationOutMinRecordP.setCheckerName(checker.getName()); simpleApplicationOutMinRecordP.setCheckerName(checker.getName());
simpleApplicationOutMinRecordP.setPcode(placeByDid.getCode()); simpleApplicationOutMinRecordP.setPcode(placeByDid.getCode());
// 当已经完成出库时设置数量为出库数 // 当已经完成出库时设置数量为出库数
simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity()); simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity() );
} }
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(materialById.getId()); List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(materialById.getId());
if (materialAndProducedDateByMid.size() > 0) { if (materialAndProducedDateByMid.size() > 0) {
@ -827,7 +828,22 @@ public class DepositoryRecordController {
mcode.append(inventory.getCode()).append(","); mcode.append(inventory.getCode()).append(",");
depositoryName.append(depository.getDname()).append(","); depositoryName.append(depository.getDname()).append(",");
sumQuantity += applicationOutRecordMin.getQuantity(); sumQuantity += applicationOutRecordMin.getQuantity();
String unit = applicationOutRecordMin.getUnit();
if("-1".equals(unit)){
sumPrice += (inventory.getPrice() * applicationOutRecordMin.getQuantity()); sumPrice += (inventory.getPrice() * applicationOutRecordMin.getQuantity());
}else{
// 获取当前对应的拆单记录
Map<String,Object> paramForSplitInfo = new HashMap<>();
paramForSplitInfo.put("mid",inventory.getMid());
paramForSplitInfo.put("newUnit",unit);
SplitInfo splitInfo = splitUnitService.findSplitInfoByMidAndUnit(paramForSplitInfo);
// 获取当前拆单记录与基础单位进制
int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
BigDecimal bg = new BigDecimal(inventory.getPrice() / splitInfoScaleQuantity);
double newprice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
sumPrice += (newprice * applicationOutRecordMin.getQuantity());
}
} }
outRecordP.setMcode(mcode.toString()); outRecordP.setMcode(mcode.toString());
outRecordP.setMname(mname.toString()); outRecordP.setMname(mname.toString());

4
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -2527,9 +2527,9 @@ public class PageController {
map.put("depositoryId", depositoryId); map.put("depositoryId", depositoryId);
// 获取当前仓库下的所有库存 // 获取当前仓库下的所有库存
List<InventoryP> inventoryByDepository = materialService.findInventoryByDepository(map); List<InventoryP> inventoryByDepository = materialService.findInventoryByDepository(map);
for (int i = 0; i < inventoryByDepository.size(); i++) { for (InventoryP inventoryP : inventoryByDepository) {
// 如果该库存明细在默认库位中 // 如果该库存明细在默认库位中
MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, inventoryByDepository.get(i).getId()); MaterialAndPlace placeAndMaterialByMidAndPid = placeService.findPlaceAndMaterialByMidAndPid(0, inventoryP.getId());
if (placeAndMaterialByMidAndPid != null) { if (placeAndMaterialByMidAndPid != null) {
// 如果是默认库位 // 如果是默认库位
midList.add(placeAndMaterialByMidAndPid.getMid()); midList.add(placeAndMaterialByMidAndPid.getMid());

9
src/main/java/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -1341,13 +1341,14 @@
<if test="trueOut != null"> <if test="trueOut != null">
trueOut = #{trueOut}, trueOut = #{trueOut},
</if> </if>
<if test="adminorgid != null and adminorgid != ''"> <if test="constructionUnitId != null and constructionUnitId != ''">
adminorgid = #{adminorgid}, constructionunitid = #{constructionUnitId},
</if> </if>
<if test="constructionunitid != null and constructionunitid != ''"> <if test="adminorgId != null and adminorgId != ''">
constructionunitid = #{constructionunitid} adminorgid = #{adminorgId}
</if> </if>
where id = #{id} where id = #{id}
</set> </set>

4
src/main/java/com/dreamchaser/depository_manage/pojo/ApplicationOutRecordMinP.java

@ -124,7 +124,7 @@ public class ApplicationOutRecordMinP {
/** /**
* 已经出库的数量 * 已经出库的数量
*/ */
private Integer trueOut; private Double trueOut;
@ -142,6 +142,6 @@ public class ApplicationOutRecordMinP {
this.transferId = recordMin.getTransferId(); this.transferId = recordMin.getTransferId();
this.constructionUnitId = recordMin.getConstructionUnitId(); this.constructionUnitId = recordMin.getConstructionUnitId();
this.adminorgId = recordMin.getAdminorgId(); this.adminorgId = recordMin.getAdminorgId();
this.trueOut = recordMin.getTrueOut(); this.trueOut =(double) (recordMin.getTrueOut() / 100);
} }
} }

2
src/main/java/com/dreamchaser/depository_manage/pojo/SimpleApplicationOutMinRecordP.java

@ -80,7 +80,7 @@ public class SimpleApplicationOutMinRecordP {
/** /**
* 已经出库的数量 * 已经出库的数量
*/ */
private Integer trueOut; private Double trueOut;
/** /**
* 用于展示的数量 * 用于展示的数量

2
src/main/java/com/dreamchaser/depository_manage/service/DepositoryRecordService.java

@ -555,6 +555,6 @@ public interface DepositoryRecordService {
* @param realSplitInfo 实际出库的拆单记录 * @param realSplitInfo 实际出库的拆单记录
* @return * @return
*/ */
RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, int quantity, int nowQuantity, SplitInfo realSplitInfo); RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, double quantity, double nowQuantity, SplitInfo realSplitInfo);
} }

119
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -262,7 +262,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
String code = createCode(dname, "outOrderNumber", "out", company.getName()); String code = createCode(dname, "outOrderNumber", "out", company.getName());
map.put("code", code); map.put("code", code);
map.put("pass", 3); map.put("pass", 3);
map.put("quantity",quantity); map.put("quantity", quantity);
return depositoryRecordMapper.insertApplicationOutRecord(map); return depositoryRecordMapper.insertApplicationOutRecord(map);
} }
@ -865,7 +865,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public List<ApplicationOutRecordMinP> findApplicationOutRecordMinByParent(Integer id) { public List<ApplicationOutRecordMinP> findApplicationOutRecordMinByParent(Integer id) {
List<ApplicationOutRecordMin> outRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id); List<ApplicationOutRecordMin> outRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(id);
List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>(); List<ApplicationOutRecordMinP> recordMinPList = new ArrayList<>();
for (ApplicationOutRecordMin aorm:outRecordMinByParent for (ApplicationOutRecordMin aorm : outRecordMinByParent
) { ) {
ApplicationOutRecordMinP aormP = new ApplicationOutRecordMinP(aorm); ApplicationOutRecordMinP aormP = new ApplicationOutRecordMinP(aorm);
recordMinPList.add(aormP); recordMinPList.add(aormP);
@ -894,7 +894,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public List<ApplicationOutRecordMinP> findApplicationOutMinByCondition(Map<String, Object> map) { public List<ApplicationOutRecordMinP> findApplicationOutMinByCondition(Map<String, Object> map) {
List<ApplicationOutRecordMin> condition = depositoryRecordMapper.findApplicationOutMinByCondition(map); List<ApplicationOutRecordMin> condition = depositoryRecordMapper.findApplicationOutMinByCondition(map);
List<ApplicationOutRecordMinP> result = new ArrayList<>(); List<ApplicationOutRecordMinP> result = new ArrayList<>();
for (ApplicationOutRecordMin aorm:condition for (ApplicationOutRecordMin aorm : condition
) { ) {
result.add(new ApplicationOutRecordMinP(aorm)); result.add(new ApplicationOutRecordMinP(aorm));
} }
@ -913,7 +913,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("parentId", parentId); map.put("parentId", parentId);
List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map); List<ApplicationOutRecordMin> applicationOutMinByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map);
List<ApplicationOutRecordMinP> applicationOutRecordMinPList = new ArrayList<>(); List<ApplicationOutRecordMinP> applicationOutRecordMinPList = new ArrayList<>();
for (ApplicationOutRecordMin recordMin:applicationOutMinByCondition for (ApplicationOutRecordMin recordMin : applicationOutMinByCondition
) { ) {
ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin); ApplicationOutRecordMinP recordMinP = new ApplicationOutRecordMinP(recordMin);
applicationOutRecordMinPList.add(recordMinP); applicationOutRecordMinPList.add(recordMinP);
@ -953,7 +953,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Integer istransfer = record.getIstransfer(); Integer istransfer = record.getIstransfer();
// 获取要出库的数量 // 获取要出库的数量
Integer trueOut = ObjectFormatUtil.toInteger(param.get("trueOut")); Double trueOut = ObjectFormatUtil.toDouble(param.get("trueOut"));
// 获取出库库位 // 获取出库库位
Integer placeId = ObjectFormatUtil.toInteger(param.get("placeId")); Integer placeId = ObjectFormatUtil.toInteger(param.get("placeId"));
@ -978,7 +978,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params); placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params);
if (placeAndMaterialByMidAndPid != null) { if (placeAndMaterialByMidAndPid != null) {
// 如果当前库位存在该物料 // 如果当前库位存在该物料
if (placeAndMaterialByMidAndPid.getQuantity() < trueOut) { if (placeAndMaterialByMidAndPid.getQuantity() < trueOut * 100) {
// 如果当前库位数量不足 // 如果当前库位数量不足
flag = false; flag = false;
} }
@ -1010,20 +1010,20 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果物料数量可以出库并且库位数量充足 // 如果物料数量可以出库并且库位数量充足
if (inventory.getQuantity() >= trueOut && flag) { if (inventory.getQuantity() >= trueOut && flag) {
// 当前出库数量 // 当前出库数量
Integer quantity = trueOut; Double quantity = trueOut * 100;
inventory.setQuantity(inventory.getQuantity() - quantity); inventory.setQuantity(inventory.getQuantity() - quantity.intValue());
inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - quantity); inventory.setNumberOfTemporary(inventory.getNumberOfTemporary() - quantity.intValue());
// 修改物料信息 // 修改物料信息
materialMapper.updateInventory(inventory); materialMapper.updateInventory(inventory);
// 修改当前库位存放物料的数量 // 修改当前库位存放物料的数量
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - quantity); placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - quantity.intValue());
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid);
// 修改库位数量 // 修改库位数量
Place placeById = placeMapper.findPlaceById(placeId); Place placeById = placeMapper.findPlaceById(placeId);
placeById.setQuantity(placeById.getQuantity() - quantity); placeById.setQuantity(placeById.getQuantity() - quantity.intValue());
placeMapper.UpdatePlace(placeById); placeMapper.UpdatePlace(placeById);
@ -1057,9 +1057,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
materialAndProducedDateByMid) { materialAndProducedDateByMid) {
if (materialAndProducedDate.getInventory() > quantity) { if (materialAndProducedDate.getInventory() > quantity) {
// 设置使用的数量 // 设置使用的数量
materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + quantity); materialAndProducedDate.setExpendnum(materialAndProducedDate.getExpendnum() + quantity.intValue());
// 设置剩余的数量 // 设置剩余的数量
materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - quantity); materialAndProducedDate.setInventory(materialAndProducedDate.getInventory() - quantity.intValue());
materialMapper.updateMaterialAndProducedDate(materialAndProducedDate); materialMapper.updateMaterialAndProducedDate(materialAndProducedDate);
// 跳出循环 // 跳出循环
break; break;
@ -1073,7 +1073,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足"));
} }
} else { }
else {
// 如果是拆单后的出库 // 如果是拆单后的出库
// 用于获取对应的拆单记录 // 用于获取对应的拆单记录
@ -1100,16 +1101,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (splitInventory != null) { if (splitInventory != null) {
// 如果拆单库存处理记录存在 // 如果拆单库存处理记录存在
if (splitInventory.getSaveQuantity() >= trueOut) { if (splitInventory.getSaveQuantity() >= trueOut * 100) {
// 如果当前待处理树可以满足需求 // 如果当前待处理树可以满足需求
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - trueOut); splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - (int) (trueOut * 100));
// 设置当前拆单后的出库数量 // 设置当前拆单后的出库数量
if (splitInventory.getOutQuantity() != null) { if (splitInventory.getOutQuantity() != null) {
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + trueOut); splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (trueOut * 100));
} else { } else {
splitInventory.setOutQuantity(trueOut); splitInventory.setOutQuantity((int) (trueOut * 100));
} }
// 修改库存处理记录 // 修改库存处理记录
@ -1141,7 +1142,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SplitInfo splitInfoById = splitUnitMapper.findSplitInfoById(splitInventory.getSid()); SplitInfo splitInfoById = splitUnitMapper.findSplitInfoById(splitInventory.getSid());
// 获取剩余不足的数量 // 获取剩余不足的数量
int surplus = trueOut - splitInventory.getSaveQuantity(); int surplus = (int) (trueOut * 100 - splitInventory.getSaveQuantity());
if (splitInfoById.getParentId() != null) { if (splitInfoById.getParentId() != null) {
// 如果当前拆单有父级 // 如果当前拆单有父级
@ -1178,11 +1179,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent);
} else { }
else {
// 如果当前拆单没有父级 // 如果当前拆单没有父级
if (surplus <= splitInfoById.getQuantity()) { if (surplus <= splitInfoById.getQuantity() * 100) {
// 如果当前未处理的数量小于当前拆单库存数量 // 如果当前未处理的数量小于当前拆单库存数量
@ -1196,7 +1198,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (placeAndMaterialByMidAndPid != null) { if (placeAndMaterialByMidAndPid != null) {
// 如果当前库位存在该物料 // 如果当前库位存在该物料
if (placeAndMaterialByMidAndPid.getQuantity() < 1) { if (placeAndMaterialByMidAndPid.getQuantity() < 100) {
// 如果当前库存中的物料库存不足以出库 // 如果当前库存中的物料库存不足以出库
flag = false; flag = false;
} }
@ -1208,10 +1210,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
// 如果物料数量可以出库并且库位数量充足 // 如果物料数量可以出库并且库位数量充足
if (inventory.getQuantity() >= 1 && flag) { if (inventory.getQuantity() >= 100 && flag) {
// 令库存-1 // 令库存-1
inventory.setQuantity(inventory.getQuantity() - 1); inventory.setQuantity(inventory.getQuantity() - 100);
// 修改库存记录 // 修改库存记录
@ -1219,12 +1221,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改当前库位存放物料的数量 // 修改当前库位存放物料的数量
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 1); placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - 100);
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid);
// 修改库位数量 // 修改库位数量
Place placeById = placeMapper.findPlaceById(placeId); Place placeById = placeMapper.findPlaceById(placeId);
placeById.setQuantity(placeById.getQuantity() - 1); placeById.setQuantity(placeById.getQuantity() - 100);
placeMapper.UpdatePlace(placeById); placeMapper.UpdatePlace(placeById);
@ -1238,8 +1240,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
// 设置剩余拆单库存处理数量 // 设置剩余拆单库存处理数量
splitInventory.setSaveQuantity(splitInfoById.getQuantity() + splitInventory.getSaveQuantity() - trueOut); splitInventory.setSaveQuantity(splitInfoById.getQuantity() * 100 + splitInventory.getSaveQuantity() - (int) (trueOut * 100));
splitInventory.setOutQuantity(splitInventory.getOutQuantity() + trueOut); splitInventory.setOutQuantity(splitInventory.getOutQuantity() + (int) (trueOut * 100));
splitUnitMapper.updateSplitInventory(splitInventory); splitUnitMapper.updateSplitInventory(splitInventory);
// 如果是库存转移订单 // 如果是库存转移订单
@ -1258,16 +1260,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功"));
} else { }
else {
restResponse.setStatus(508); restResponse.setStatus(508);
restResponse.setData(""); restResponse.setData("");
restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足")); restResponse.setStatusInfo(new StatusInfo("出库失败", "出库失败,库存不足"));
} }
} else { }
else {
// 如果大于 // 如果大于
// 获取库存重要减少的数量 // 获取库存重要减少的数量
int surplus_redundant = surplus / splitInfoById.getQuantity(); int surplus_redundant = surplus / (splitInfoById.getQuantity() * 100);
// 获取拆单库存处理中要处理数量 // 获取拆单库存处理中要处理数量
int saveQuantity = surplus - surplus_redundant * splitInfoById.getQuantity(); int saveQuantity = surplus - surplus_redundant * splitInfoById.getQuantity();
@ -1275,8 +1279,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果要处理的数量大于剩余数量 // 如果要处理的数量大于剩余数量
// 获取一个数量 // 获取一个数量
surplus_redundant += 1; surplus_redundant += 100;
splitInventory.setSaveQuantity(splitInfoById.getQuantity() + splitInventory.getSaveQuantity() - saveQuantity); splitInventory.setSaveQuantity(splitInfoById.getQuantity() * 100 + splitInventory.getSaveQuantity() - saveQuantity);
} else { } else {
// 如果不大于 // 如果不大于
splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity); splitInventory.setSaveQuantity(splitInventory.getSaveQuantity() - saveQuantity);
@ -1326,7 +1330,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果是库存转移订单 // 如果是库存转移订单
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (record.getIstransfer() == 1) { if (record.getIstransfer() == 1) {
map.put("quantity", String.valueOf(surplus_redundant)); map.put("quantity", String.valueOf((double)surplus_redundant / 100));
map.put("applicantId", record.getApplicantId()); map.put("applicantId", record.getApplicantId());
map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号 map.put("minRecordId", applicationOutMinById.getId()); // 出库订单编号
transferMaterial(map); transferMaterial(map);
@ -1346,33 +1350,34 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
} }
} else { }
else {
// 如果拆单库存处理记录不存在 // 如果拆单库存处理记录不存在
int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); int scale = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1);
if (inventory.getQuantity() * scale > trueOut) { if (inventory.getQuantity() * scale >= trueOut) {
// 如果当前库存数量满足要求 // 如果当前库存数量满足要求
// 获取当前出库的具体数目 // 获取当前出库的具体数目
int residue = (int) Math.ceil(trueOut / (double) splitInfo.getQuantity()); int residue = (int) Math.ceil(trueOut / (double) splitInfo.getQuantity());
// 获取剩余数目 // 获取剩余数目
int residue_realQuantity = residue * scale - trueOut; double residue_realQuantity = residue * scale - trueOut;
// 设置新库存 // 设置新库存
inventory.setQuantity(inventory.getQuantity() - residue); inventory.setQuantity(inventory.getQuantity() - residue * 100);
//更新库存 //更新库存
materialMapper.updateInventory(inventory); materialMapper.updateInventory(inventory);
// 更新对应库位的库存 // 更新对应库位的库存
// 修改当前库位存放物料的数量 // 修改当前库位存放物料的数量
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue); placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() - residue * 100);
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid);
// 修改库位数量 // 修改库位数量
Place placeById = placeMapper.findPlaceById(placeId); Place placeById = placeMapper.findPlaceById(placeId);
placeById.setQuantity(placeById.getQuantity() - residue); placeById.setQuantity(placeById.getQuantity() - residue * 100);
placeMapper.UpdatePlace(placeById); placeMapper.UpdatePlace(placeById);
@ -1434,7 +1439,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @param realSplitInfo 实际出库的拆单记录 * @param realSplitInfo 实际出库的拆单记录
* @return * @return
*/ */
public RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, int quantity, int nowQuantity, SplitInfo realSplitInfo) { public RestResponse updateOutSplitInventoryInfo(SplitInfo splitInfo, MaterialAndPlace materialAndPlace, double quantity, double nowQuantity, SplitInfo realSplitInfo) {
// 定义返回值 // 定义返回值
RestResponse restResponse = new RestResponse(); RestResponse restResponse = new RestResponse();
// 用于获取当前拆单记录对应的拆单库存记录 // 用于获取当前拆单记录对应的拆单库存记录
@ -1444,15 +1449,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SplitInventory splitInventoryForSplitInfo = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); SplitInventory splitInventoryForSplitInfo = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory);
// 获取当前拆单记录与实际出库拆单之间的进制 // 获取当前拆单记录与实际出库拆单之间的进制
int parentScale = splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, splitInfo.getId()); int parentScale = splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, splitInfo.getId());
if (splitInventoryForSplitInfo.getSaveQuantity() * parentScale >= nowQuantity) { if (splitInventoryForSplitInfo.getSaveQuantity() * parentScale >= nowQuantity * 100) {
// 如果当前库存拆单记录的库存可以满足需要 // 如果当前库存拆单记录的库存可以满足需要
// 计算当前拆单库存具体减少的数量 // 计算当前拆单库存具体减少的数量
int realSaveQuantity = (int) Math.ceil(nowQuantity / (double) parentScale); int realSaveQuantity = (int) Math.ceil(nowQuantity / (double) parentScale);
// 设置当前拆单库存 // 设置当前拆单库存
splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - realSaveQuantity); splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - realSaveQuantity * 100);
// 设置当前拆单出库库存数 // 设置当前拆单出库库存数
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + realSaveQuantity); splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + realSaveQuantity * 100);
// 修改库存记录 // 修改库存记录
splitUnitMapper.updateSplitInventory(splitInventoryForSplitInfo); splitUnitMapper.updateSplitInventory(splitInventoryForSplitInfo);
@ -1462,7 +1467,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
paramForSplitInventory.put("sid", splitInfoByParentId.getId()); paramForSplitInventory.put("sid", splitInfoByParentId.getId());
// 获取对应子类的库存 // 获取对应子类的库存
SplitInventory splitInventoryBySplitInfoByParentId = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); SplitInventory splitInventoryBySplitInfoByParentId = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory);
splitInventoryBySplitInfoByParentId.setSaveQuantity(realSaveQuantity * parentScale - nowQuantity); splitInventoryBySplitInfoByParentId.setSaveQuantity((int) (realSaveQuantity * parentScale - nowQuantity) * 100);
splitUnitMapper.updateSplitInventory(splitInventoryBySplitInfoByParentId); splitUnitMapper.updateSplitInventory(splitInventoryBySplitInfoByParentId);
} }
restResponse.setStatus(200); restResponse.setStatus(200);
@ -1517,7 +1522,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 设置当前库存数量 // 设置当前库存数量
splitInventoryForSplitInfo.setSaveQuantity(scale * splitInfo.getQuantity() - splitInventoryForSplitInfo.getSaveQuantity()); splitInventoryForSplitInfo.setSaveQuantity(scale * splitInfo.getQuantity() - splitInventoryForSplitInfo.getSaveQuantity());
// 设置当前出库数量 // 设置当前出库数量
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + ((quantity - splitInventoryForSplitInfo.getSaveQuantity()))); splitInventoryForSplitInfo.setOutQuantity((int) (splitInventoryForSplitInfo.getOutQuantity() + ((quantity * 100 - splitInventoryForSplitInfo.getSaveQuantity()))));
// 修改当前拆单库存处理记录 // 修改当前拆单库存处理记录
} else { } else {
@ -1531,9 +1536,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
splitUnitMapper.updateSplitInventory(parentSplitInventoryForSplitInfo); splitUnitMapper.updateSplitInventory(parentSplitInventoryForSplitInfo);
// 设置当前拆单库存数 // 设置当前拆单库存数
splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - quantity); splitInventoryForSplitInfo.setSaveQuantity(splitInventoryForSplitInfo.getSaveQuantity() - (int) (quantity * 100));
// 设置当前拆单库存出库数 // 设置当前拆单库存出库数
splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + quantity); splitInventoryForSplitInfo.setOutQuantity(splitInventoryForSplitInfo.getOutQuantity() + (int) (quantity * 100));
// 修改当前拆单库存处理记录 // 修改当前拆单库存处理记录
} }
@ -1566,7 +1571,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
splitInfoScaleQuantity *= splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, parentSplitInfo.getId()); splitInfoScaleQuantity *= splitUnitService.findSplitInfoScaleQuantity(realSplitInfo, parentSplitInfo.getId());
} }
if (data != null && !"".equals(data.toString())) { if (data != null && !"".equals(data.toString())) {
int surplus_redundant = ObjectFormatUtil.toInteger(data) * (int) splitInfoScaleQuantity; double surplus_redundant = ObjectFormatUtil.toDouble(data) * splitInfoScaleQuantity;
if (surplus_redundant - nowQuantity == 0) { if (surplus_redundant - nowQuantity == 0) {
// 如果刚好完成出库且没有剩余 // 如果刚好完成出库且没有剩余
restResponse.setStatus(200); restResponse.setStatus(200);
@ -1602,7 +1607,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果可以出库 // 如果可以出库
// 计算当前不足的数量 // 计算当前不足的数量
int residue_quantity = realQuantity - nowQuantity; double residue_quantity = realQuantity - nowQuantity;
// 计算库存需要减少的数量 // 计算库存需要减少的数量
int inventory_quantity = (int) Math.ceil((double) residue_quantity / splitInfoQuantity); int inventory_quantity = (int) Math.ceil((double) residue_quantity / splitInfoQuantity);
@ -1673,7 +1678,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
* @param userAgent user-agent * @param userAgent user-agent
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Integer trueOut, UserByPort userByPort, Integer placeId, String userAgent) { void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent) {
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值 String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
// 修改redis中本子订单状态 // 修改redis中本子订单状态
// redisTemplate.opsForHash().put(redisMinRecordKey,"state","2"); // redisTemplate.opsForHash().put(redisMinRecordKey,"state","2");
@ -1681,7 +1686,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString()); // redisTemplate.opsForHash().put(redisMinRecordKey,"manager",userByPort.getId().toString());
// 修改当前已经出库的数量 // 修改当前已经出库的数量
applicationOutMinById.setTrueOut(trueOut + applicationOutMinById.getTrueOut()); applicationOutMinById.setTrueOut((int) (trueOut * 100) + applicationOutMinById.getTrueOut());
if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) { if (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut() > 0) {
// 如果当前子订单中的物料并未完全出库 // 如果当前子订单中的物料并未完全出库
depositoryRecordMapper.updateApplicationOutRecordMin(applicationOutMinById); depositoryRecordMapper.updateApplicationOutRecordMin(applicationOutMinById);
@ -2631,7 +2636,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 用于调用入库方法而创建的 // 用于调用入库方法而创建的
Map<String, Object> paramForUpdateInventory = new HashMap<>(); Map<String, Object> paramForUpdateInventory = new HashMap<>();
paramForUpdateInventory.put("mid", recordP.getMid()); paramForUpdateInventory.put("mid", recordP.getMid());
paramForUpdateInventory.put("quantity", (double)recordP.getQuantity() / 100); paramForUpdateInventory.put("quantity", (double) recordP.getQuantity() / 100);
paramForUpdateInventory.put("depositoryId", recordP.getDepositoryId()); paramForUpdateInventory.put("depositoryId", recordP.getDepositoryId());
paramForUpdateInventory.put("placeId", recordP.getPlaceId()); paramForUpdateInventory.put("placeId", recordP.getPlaceId());
if (materialById.getUnit().equals(recordP.getAirUnit())) { if (materialById.getUnit().equals(recordP.getAirUnit())) {
@ -3630,7 +3635,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId) { public List<ApplicationOutRecordP> findApplicationOutRecordByDepository(String depositoryId) {
List<ApplicationOutRecord> recordList = depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId); List<ApplicationOutRecord> recordList = depositoryRecordMapper.findApplicationOutRecordByDepository(depositoryId);
List<ApplicationOutRecordP> result = new ArrayList<>(); List<ApplicationOutRecordP> result = new ArrayList<>();
for (ApplicationOutRecord record:recordList for (ApplicationOutRecord record : recordList
) { ) {
ApplicationOutRecordP recordP = new ApplicationOutRecordP(record); ApplicationOutRecordP recordP = new ApplicationOutRecordP(record);
result.add(recordP); result.add(recordP);
@ -3890,7 +3895,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Material materialById = materialMapper.findMaterialById(mid); Material materialById = materialMapper.findMaterialById(mid);
if (materialById.getPrice() != null) { if (materialById.getPrice() != null) {
sum += (materialById.getPrice() / 100) * ((double)applicationOutRecordMin.getQuantity() / 100); sum += (materialById.getPrice() / 100) * ((double) applicationOutRecordMin.getQuantity() / 100);
} else { } else {
sum += 0; sum += 0;
} }
@ -4592,8 +4597,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 数量 // 数量
double count = 0; double count = 0;
for (ApplicationOutRecordMin recordMin : minList) { for (ApplicationOutRecordMin recordMin : minList) {
double quantity =(double) recordMin.getQuantity() / 100; double quantity = (double) recordMin.getQuantity() / 100;
count += quantity ; count += quantity;
// 获取当前出库物料 // 获取当前出库物料
Inventory materialById = materialMapper.findInventoryById(recordMin.getMid()); Inventory materialById = materialMapper.findInventoryById(recordMin.getMid());
// 计算当前出库金额 // 计算当前出库金额

4
src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java

@ -775,7 +775,7 @@ public class QyWxOperationService {
unit = materialById.getUnit(); unit = materialById.getUnit();
} }
content.append(">- 物料名称:").append(materialById.getMname()).append("%n"); content.append(">- 物料名称:").append(materialById.getMname()).append("%n");
content.append(">- 申请数量:").append(recordMin.getQuantity()).append("%n"); content.append(">- 申请数量:").append(recordMin.getQuantity() / 100).append("%n");
content.append(">- 出库单位:").append(unit).append("%n"); content.append(">- 出库单位:").append(unit).append("%n");
content.append(">- 所处仓库:").append(depositoryRecordById.getDname()).append("%n"); content.append(">- 所处仓库:").append(depositoryRecordById.getDname()).append("%n");
content.append(">- 出库人员:").append(userByPort.getName()).append("%n"); content.append(">- 出库人员:").append(userByPort.getName()).append("%n");
@ -1233,7 +1233,7 @@ public class QyWxOperationService {
TemplateCard_horizontal_content horizontal_content_quantity = new TemplateCard_horizontal_content(); TemplateCard_horizontal_content horizontal_content_quantity = new TemplateCard_horizontal_content();
horizontal_content_quantity.setType(0); horizontal_content_quantity.setType(0);
horizontal_content_quantity.setKeyname("申请数量:"); horizontal_content_quantity.setKeyname("申请数量:");
horizontal_content_quantity.setValue(recordMin.getQuantity().toString()); horizontal_content_quantity.setValue(String.valueOf(recordMin.getQuantity() / 100));
// 申请单位 // 申请单位
TemplateCard_horizontal_content horizontal_content_unit = new TemplateCard_horizontal_content(); TemplateCard_horizontal_content horizontal_content_unit = new TemplateCard_horizontal_content();

1
src/main/resources/templates/pages/depository/table-in.html

@ -169,7 +169,6 @@
{field: 'airUnit', width: 100, title: '计量单位'}, {field: 'airUnit', width: 100, title: '计量单位'},
{field: 'mcode', width: 150, title: '存货编码'}, {field: 'mcode', width: 150, title: '存货编码'},
{field: 'quantity', width: 150, title: '数量', sort: true}, {field: 'quantity', width: 150, title: '数量', sort: true},
{field: 'price', title: '金额', minWidth: 150, sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'applicantName', width: 200, title: '提交人'}, {field: 'applicantName', width: 200, title: '提交人'},
{field: 'applicantTime', width: 200, title: '提交时间', sort: true}, {field: 'applicantTime', width: 200, title: '提交时间', sort: true},

8
src/main/resources/templates/pages/place/materialForPlace.html

@ -34,11 +34,15 @@
</tr> </tr>
<tr> <tr>
<td>库存</td> <td>库存</td>
<td id="quantity" th:text="${record.getQuantity()+':'+inventory.getUnit()}">409</td> <td id="quantity" th:text="${(record.getQuantity() / 100)+':'+inventory.getUnit()}">
409
</td>
</tr> </tr>
<tr th:each="splitInventory,iterStar: ${splitInventoryList}"> <tr th:each="splitInventory,iterStar: ${splitInventoryList}">
<td>库存</td> <td>库存</td>
<td th:text="${splitInventory.getSaveQuantity()+':'+splitInventory.getSplitInfo().getNewUnit()}">409</td> <td th:text="${(splitInventory.getSaveQuantity() / 100 )+':'+splitInventory.getSplitInfo().getNewUnit()}">
409
</td>
</tr> </tr>
<tr> <tr>
</tr> </tr>

9
src/main/resources/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html

@ -63,7 +63,12 @@
} else { } else {
wxScan = wxScan.parent.wx; wxScan = wxScan.parent.wx;
} }
wxScan.scanQRCode({
var result = "1635078996227301376";//当needResult为1时返回处理结果
var req = {};
req.qrCode = result;
outboundLogic(req);
/* wxScan.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
@ -82,7 +87,7 @@
} }
}); });*/
}); });

2
src/test/java/com/dreamchaser/depository_manage/TestForOther.java

@ -47,7 +47,7 @@ public class TestForOther {
ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver(); ApprovalInfo_Details_Approver approver = new ApprovalInfo_Details_Approver();
approver.setUserId("PangFuZhen"); approver.setUserId("PangFuZhen");
approvalInfo.setApprover(approver); approvalInfo.setApprover(approver);
depositoryRecordService.reviewByQyWxApprovalOut("1",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303170033", false,2); depositoryRecordService.reviewByQyWxApprovalOut("5",approvalInfo,"460f46eaefb46bb0c171029f62e2cea6","2","202303180009", false,2);
} }

9
target/classes/com/dreamchaser/depository_manage/mapper/DepositoryRecordMapper.xml

@ -1341,13 +1341,14 @@
<if test="trueOut != null"> <if test="trueOut != null">
trueOut = #{trueOut}, trueOut = #{trueOut},
</if> </if>
<if test="adminorgid != null and adminorgid != ''"> <if test="constructionUnitId != null and constructionUnitId != ''">
adminorgid = #{adminorgid}, constructionunitid = #{constructionUnitId},
</if> </if>
<if test="constructionunitid != null and constructionunitid != ''"> <if test="adminorgId != null and adminorgId != ''">
constructionunitid = #{constructionunitid} adminorgid = #{adminorgId}
</if> </if>
where id = #{id} where id = #{id}
</set> </set>

1
target/classes/templates/pages/depository/table-in.html

@ -169,7 +169,6 @@
{field: 'airUnit', width: 100, title: '计量单位'}, {field: 'airUnit', width: 100, title: '计量单位'},
{field: 'mcode', width: 150, title: '存货编码'}, {field: 'mcode', width: 150, title: '存货编码'},
{field: 'quantity', width: 150, title: '数量', sort: true}, {field: 'quantity', width: 150, title: '数量', sort: true},
{field: 'price', title: '金额', minWidth: 150, sort: true},
{field: 'depositoryName', width: 150, title: '仓库名称'}, {field: 'depositoryName', width: 150, title: '仓库名称'},
{field: 'applicantName', width: 200, title: '提交人'}, {field: 'applicantName', width: 200, title: '提交人'},
{field: 'applicantTime', width: 200, title: '提交时间', sort: true}, {field: 'applicantTime', width: 200, title: '提交时间', sort: true},

8
target/classes/templates/pages/place/materialForPlace.html

@ -34,11 +34,15 @@
</tr> </tr>
<tr> <tr>
<td>库存</td> <td>库存</td>
<td id="quantity" th:text="${record.getQuantity()+':'+inventory.getUnit()}">409</td> <td id="quantity" th:text="${(record.getQuantity() / 100)+':'+inventory.getUnit()}">
409
</td>
</tr> </tr>
<tr th:each="splitInventory,iterStar: ${splitInventoryList}"> <tr th:each="splitInventory,iterStar: ${splitInventoryList}">
<td>库存</td> <td>库存</td>
<td th:text="${splitInventory.getSaveQuantity()+':'+splitInventory.getSplitInfo().getNewUnit()}">409</td> <td th:text="${(splitInventory.getSaveQuantity() / 100 )+':'+splitInventory.getSplitInfo().getNewUnit()}">
409
</td>
</tr> </tr>
<tr> <tr>
</tr> </tr>

9
target/classes/templates/pages/scanQrCode/ScanBarOrQrCodeOut.html

@ -63,7 +63,12 @@
} else { } else {
wxScan = wxScan.parent.wx; wxScan = wxScan.parent.wx;
} }
wxScan.scanQRCode({
var result = "1635078996227301376";//当needResult为1时返回处理结果
var req = {};
req.qrCode = result;
outboundLogic(req);
/* wxScan.scanQRCode({
desc: 'scanQRCode desc', desc: 'scanQRCode desc',
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 scanType: ["barCode", "qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有
@ -82,7 +87,7 @@
} }
}); });*/
}); });

Loading…
Cancel
Save