Compare commits

..

7 Commits

10 changed files with 100 additions and 31 deletions

View File

@@ -4,7 +4,7 @@ import org.apache.commons.lang3.BooleanUtils;
public class MaterialOrderItemConsts {
// 根据当前阶段的是否考虑管线号,返回之前阶段的管线号
// 根据当前阶段的是否考虑单元号、管线号、隔热代号,返回之前阶段的管线号
public static String getPrevStageLineAccount(Boolean ignoreLineAccount, String prevStageLineAccount) {
return BooleanUtils.isTrue(ignoreLineAccount) ? "-" : prevStageLineAccount;
}

View File

@@ -481,7 +481,7 @@ public class MaterialOrderController extends BaseController {
return RespData.error("阶段不能为空");
}
if (ignoreLineAccount == null) {
return RespData.error("是否考虑管线号不能为空");
return RespData.error("是否考虑单元号、管线号、隔热代号不能为空");
}
}
//获得文件名

View File

@@ -131,7 +131,7 @@ public class MaterialOrder extends OrderBase{
/** 是否创建订货单 */
private Boolean hasPurchaseOrder;
/** 匹配忽略管线号 */
/** 匹配忽略单元号、管线号、隔热代号 */
private Boolean ignoreLineAccount;
public String getName() {

View File

@@ -672,9 +672,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
+"_"+diameterLStr+"_"+wallThicknessSStr+"_"+materialOrderItem.getShortDescription()
+"_"+wallThicknessLStr+"_"+materialOrderItem.getMaterial()
+"_"+materialOrderItem.getMemo()+"_"+materialOrderItem.getSize()
+"_"+materialOrderItem.getSpecialRequest()+"_"+materialOrderItem.getInsulationCode()
+"_"+materialOrderItem.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getInsulationCode())
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getLineAccount()) +"_"+materialOrderItem.getAreaAccount()
+"_"+materialOrderItem.getSiteAccount()+"_"+materialOrderItem.getUnitAccount()
+"_"+materialOrderItem.getSiteAccount()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getUnitAccount())
+"_"+materialOrderItem.getProductCode()+"_"+materialOrderItem.getPurchaseCode()
+"_"+materialOrderItem.getMakeCode()+"_"+materialOrderItem.getMaterialType()
+"_"+materialOrderItem.getEndFace()+"_"+materialOrderItem.getPressureLevel();
@@ -686,6 +686,13 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
countMap.put(str,count);
}
}
// 每一个阶段遍历countMap并替换负数值为 0
for (Map.Entry<String, BigDecimal> entry : countMap.entrySet()) {
BigDecimal value = entry.getValue();
if (value.compareTo(BigDecimal.ZERO) < 0) { // 如果小于 0 , 替换为 0
entry.setValue(BigDecimal.ZERO);
}
}
}
}
materialOrder.setStage(stage.getId().intValue());
@@ -826,7 +833,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
Integer ind = Integer.valueOf(ExcelUtil2.getCellValue(row.getCell(0)));
String name = ExcelUtil2.getCellValue(row.getCell(1));
String areaAccount = ExcelUtil2.getCellValue(row.getCell(2));
String unitAccount = ExcelUtil2.getCellValue(row.getCell(3));
String unitAccount = BooleanUtils.isTrue(ignoreLineAccount) ? "-" : ExcelUtil2.getCellValue(row.getCell(3));
String siteAccount = ExcelUtil2.getCellValue(row.getCell(4));
String lineAccount = BooleanUtils.isTrue(ignoreLineAccount) ? "-" : ExcelUtil2.getCellValue(row.getCell(5));
String codeType = ExcelUtil2.getCellValue(row.getCell(6));
@@ -896,7 +903,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
String endFace = ExcelUtil2.getCellValue(row.getCell(27));
String materialType = ExcelUtil2.getCellValue(row.getCell(28));
String material = ExcelUtil2.getCellValue(row.getCell(29));
String insulationCode = ExcelUtil2.getCellValue(row.getCell(30));
String insulationCode = BooleanUtils.isTrue(ignoreLineAccount) ? "-" : ExcelUtil2.getCellValue(row.getCell(30));
String specialRequest = ExcelUtil2.getCellValue(row.getCell(31));
String memo = ExcelUtil2.getCellValue(row.getCell(32));
String jacketSpec = ExcelUtil2.getCellValue(row.getCell(33));
@@ -1156,6 +1163,13 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
}
}
}
// 料单项合并后,当采购数量为负数时,不计入总数量
for (Map.Entry<String, MaterialOrderItem> entry : ignoreLineAccountMergeItemMap.entrySet()) {
MaterialOrderItem item = entry.getValue();
if (item.getCount().compareTo(BigDecimal.ZERO) < 0) { // 如果小于 0
orderCount = orderCount.subtract(item.getCount());
}
}
materialOrder.setTotalCount(orderCount);
materialOrder.setTotalWeight(orderWeight);
update(materialOrder);
@@ -1208,6 +1222,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
lm.put("line",item.get("line"));
lm.put("code",item.get("code"));
lm.put("longDescription", item.get("longDescription"));
lm.put("diameterL",item.get("diameterL"));
lm.put("diameterS",item.get("diameterS"));
lm.put("jacketSpec",item.get("jacketSpec"));
lm.put("needCount", item.get("needCount"));
lm.put("preCount", item.get("preCount"));
lm.put("errorMessage", item.get("errorMessage"));
@@ -1229,8 +1246,22 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
for (MaterialOrder prevMaterialOrder : prevMaterialOrderList) {
List<MaterialOrderItem> prevItemList = materialOrderItemService.findByVersionNum(prevMaterialOrder.getVersionNum(), prevMaterialOrder.getId());
for (MaterialOrderItem prevItem : prevItemList){
String str = prevItem.getName()+"_"+prevItem.getUnitAccount()+"_"+prevItem.getSiteAccount()
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getLineAccount()) +"_"+prevItem.getProductCode();
/*String str = prevItem.getName()+"_"+prevItem.getUnitAccount()+"_"+prevItem.getSiteAccount()
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getLineAccount()) +"_"+prevItem.getProductCode();*/
String diameterSStr = prevItem.getDiameterS()==null?"null":prevItem.getDiameterS().stripTrailingZeros().toString();
String diameterLStr = prevItem.getDiameterL()==null?"null":prevItem.getDiameterL().stripTrailingZeros().toString();
String wallThicknessSStr = prevItem.getWallThicknessS()==null?"null":prevItem.getWallThicknessS();
String wallThicknessLStr = prevItem.getWallThicknessL()==null?"null":prevItem.getWallThicknessL();
String str = prevItem.getName()+"_"+prevItem.getProductId()+"_"+diameterSStr
+"_"+diameterLStr+"_"+wallThicknessSStr+"_"+prevItem.getShortDescription()
+"_"+wallThicknessLStr+"_"+prevItem.getMaterial()
+"_"+prevItem.getMemo()+"_"+prevItem.getSize()
+"_"+prevItem.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getInsulationCode())
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getLineAccount()) +"_"+prevItem.getAreaAccount()
+"_"+prevItem.getSiteAccount()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getUnitAccount())
+"_"+prevItem.getProductCode()+"_"+prevItem.getPurchaseCode()
+"_"+prevItem.getMakeCode()+"_"+prevItem.getMaterialType()
+"_"+prevItem.getEndFace()+"_"+prevItem.getPressureLevel();
if (!prevMap.containsKey(str)){
prevMap.put(str,prevItem.getCount());
prevMapM.put(str,prevItem);
@@ -1240,13 +1271,34 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
prevMapM.put(str,prevItem);
}
}
// 每一个阶段遍历prevMap并替换负数值为 0
for (Map.Entry<String, BigDecimal> entry : prevMap.entrySet()) {
BigDecimal value = entry.getValue();
if (value.compareTo(BigDecimal.ZERO) < 0) { // 如果小于 0 , 替换为 0
entry.setValue(BigDecimal.ZERO);
}
}
}
//获取当前阶段
List<MaterialOrderItem> itemList = materialOrderItemService.findByVersionNum(materialOrder.getVersionNum(), materialOrder.getId());
int ind=0;
for (MaterialOrderItem item : itemList){
String str = item.getName()+"_"+item.getUnitAccount()+"_"+item.getSiteAccount()
+"_"+item.getLineAccount()+"_"+item.getProductCode();
/*String str = item.getName()+"_"+item.getUnitAccount()+"_"+item.getSiteAccount()
+"_"+item.getLineAccount()+"_"+item.getProductCode();*/
String diameterSStr = item.getDiameterS()==null?"null":item.getDiameterS().stripTrailingZeros().toString();
String diameterLStr = item.getDiameterL()==null?"null":item.getDiameterL().stripTrailingZeros().toString();
String wallThicknessSStr = item.getWallThicknessS()==null?"null":item.getWallThicknessS();
String wallThicknessLStr = item.getWallThicknessL()==null?"null":item.getWallThicknessL();
String str = item.getName()+"_"+item.getProductId()+"_"+diameterSStr
+"_"+diameterLStr+"_"+wallThicknessSStr+"_"+item.getShortDescription()
+"_"+wallThicknessLStr+"_"+item.getMaterial()
+"_"+item.getMemo()+"_"+item.getSize()
+"_"+item.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getInsulationCode())
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getLineAccount()) +"_"+item.getAreaAccount()
+"_"+item.getSiteAccount()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getUnitAccount())
+"_"+item.getProductCode()+"_"+item.getPurchaseCode()
+"_"+item.getMakeCode()+"_"+item.getMaterialType()
+"_"+item.getEndFace()+"_"+item.getPressureLevel();
if (ind<item.getInd())
ind=item.getInd();
if (prevMap.containsKey(str)){
@@ -1260,9 +1312,16 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line",item.getLineAccount());
map.put("code",item.getProductCode());
map.put("longDescription",item.getLongDescription());
map.put("diameterL",item.getDiameterL());
map.put("diameterS",item.getDiameterS());
map.put("jacketSpec",item.getJacketSpec());
map.put("needCount",item.getNeedCount());
map.put("preCount",prevCount);
map.put("errorMessage","当前阶段较以往阶段采购数量减少");
if(Objects.equals(item.getNeedCount(), new BigDecimal("0.000"))){
map.put("errorMessage","以往阶段已采购,当前阶段没有采购");
} else {
map.put("errorMessage","当前阶段较以往阶段采购数量减少");
}
specialList.add(map);
} else if (prevCount.compareTo(item.getNeedCount()) < 0) {
map = new HashMap<>();
@@ -1273,6 +1332,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line",item.getLineAccount());
map.put("code",item.getProductCode());
map.put("longDescription",item.getLongDescription());
map.put("diameterL",item.getDiameterL());
map.put("diameterS",item.getDiameterS());
map.put("jacketSpec",item.getJacketSpec());
map.put("needCount",item.getNeedCount());
map.put("preCount",prevCount);
map.put("errorMessage","当前阶段较以往阶段采购数量增加");
@@ -1289,6 +1351,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line",item.getLineAccount());
map.put("code",item.getProductCode());
map.put("longDescription",item.getLongDescription());
map.put("diameterL",item.getDiameterL());
map.put("diameterS",item.getDiameterS());
map.put("jacketSpec",item.getJacketSpec());
map.put("needCount",item.getNeedCount());
map.put("preCount",' ');
map.put("errorMessage","当前阶段料单新增采购");
@@ -1324,7 +1389,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
materialOrderItem.setProductId(entry.getValue().getProductId());
materialOrderItem.setName(entry.getValue().getName());
materialOrderItem.setAreaAccount(entry.getValue().getAreaAccount());
materialOrderItem.setUnitAccount(entry.getValue().getUnitAccount());
materialOrderItem.setUnitAccount(MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getUnitAccount()));
materialOrderItem.setSiteAccount(entry.getValue().getSiteAccount());
materialOrderItem.setLineAccount(MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getLineAccount()));
materialOrderItem.setCodeType(entry.getValue().getCodeType());
@@ -1341,7 +1406,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
materialOrderItem.setPressureLevel(entry.getValue().getPressureLevel());
materialOrderItem.setEndFace(entry.getValue().getEndFace());
materialOrderItem.setMaterial(entry.getValue().getMaterial());
materialOrderItem.setInsulationCode(entry.getValue().getInsulationCode());
materialOrderItem.setInsulationCode(MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getInsulationCode()));
materialOrderItem.setSpecialRequest(entry.getValue().getSpecialRequest());
materialOrderItem.setMaterialType(entry.getValue().getMaterialType());
materialOrderItem.setMakeCode(entry.getValue().getMakeCode());
@@ -1365,6 +1430,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line", MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getLineAccount()));
map.put("code",entry.getValue().getProductCode());
map.put("longDescription",entry.getValue().getLongDescription());
map.put("diameterL",entry.getValue().getDiameterL());
map.put("diameterS",entry.getValue().getDiameterS());
map.put("jacketSpec",entry.getValue().getJacketSpec());
map.put("needCount",' ');
map.put("preCount",prevMap.get(entry.getKey()));
map.put("errorMessage","以往阶段已采购,当前阶段没有采购");
@@ -2476,27 +2544,28 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
}
//确认供应商列表
Integer ind = indMap.getOrDefault(supplierProduct.getSupplier().getId(), null);
Integer supplierProductInd = Optional.ofNullable(supplierProduct.getInd()).orElse(Integer.MAX_VALUE);
if (ind == null) {
if (maxInd == null) {
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
maxInd = supplierProduct.getInd();
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
maxInd = supplierProductInd;
maxIndSupplier = supplierProduct.getSupplier().getId();
} else {
if (indMap.size() >= number && supplierProduct.getInd().compareTo(maxInd) < 0) {
if (indMap.size() >= number && supplierProductInd.compareTo(maxInd) < 0) {
indMap.remove(maxIndSupplier);
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
maxInd = supplierProduct.getInd();
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
maxInd = supplierProductInd;
maxIndSupplier = supplierProduct.getSupplier().getId();
}else if(indMap.size()<number){
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
if (supplierProduct.getInd().compareTo(maxInd)>0){
maxInd = supplierProduct.getInd();
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
if (supplierProductInd.compareTo(maxInd)>0){
maxInd = supplierProductInd;
maxIndSupplier = supplierProduct.getSupplier().getId();
}
}
}
} else if (ind.compareTo(supplierProduct.getInd()) > 0) {
indMap.put(supplierProduct.getSupplier().getId(), supplierProduct.getInd());
} else if (ind.compareTo(supplierProductInd) > 0) {
indMap.put(supplierProduct.getSupplier().getId(), supplierProductInd);
}
}
}

View File

@@ -22,7 +22,7 @@
<!-- <a class="form-setting" href="javascript:Dialog.functionDialog(null, null, '/admin/common/formSetting.html?name=product');">表单设置</a>-->
<!-- </div>-->
</div>
<div class="submitBody" data-id="addDevice" style="position:absolute;top: 20%;">
<div class="submitBody" data-id="addDevice" style="position:absolute;top: 40px;">
<style>
.input-wrapper {
float: left;

View File

@@ -22,7 +22,7 @@
<!-- <a class="form-setting" href="javascript:Dialog.functionDialog(null, null, '/admin/common/formSetting.html?name=product');">表单设置</a>-->
<!-- </div>-->
</div>
<div class="submitBody" data-id="addFile" style="position:absolute;top: 20%;">
<div class="submitBody" data-id="addFile" style="position:absolute;top: 40px;">
<style>
.input-wrapper {
float: left;
@@ -83,7 +83,7 @@
<div class="submitBody-row">
<div class="submitBody-row-position">
<div class="input-wrapper required">
<label>是否考虑管线</label>
<label>是否考虑单元号、管线号、隔热代</label>
<select id="ignoreLineAccount" name="ignoreLineAccount" data-init="false">
<option value="false"></option>
<option value="true"></option>
@@ -119,7 +119,7 @@
return;
}
if ($("#ignoreLineAccount").val() == null ||$("#ignoreLineAccount").val() == "null"){
Dialog.error("是否考虑管线号不能为空");
Dialog.error("是否考虑单元号、管线号、隔热代号不能为空");
return;
}
if (!check()) {

View File

@@ -22,7 +22,7 @@
<!-- <a class="form-setting" href="javascript:Dialog.functionDialog(null, null, '/admin/common/formSetting.html?name=product');">表单设置</a>-->
<!-- </div>-->
</div>
<div class="submitBody" data-id="addFile" style="position:absolute;top: 20%;">
<div class="submitBody" data-id="addFile" style="position:absolute;top: 40px;">
<style>
.input-wrapper {
float: left;

View File

@@ -22,7 +22,7 @@
<!-- <a class="form-setting" href="javascript:Dialog.functionDialog(null, null, '/admin/common/formSetting.html?name=product');">表单设置</a>-->
<!-- </div>-->
</div>
<div class="submitBody" data-id="addFile" style="position:absolute;top: 20%;">
<div class="submitBody" data-id="addFile" style="position:absolute;top: 40px;">
<style>
.input-wrapper {
float: left;

View File

@@ -5,7 +5,7 @@
<div class="appPage listPage">
<h1 class="page-title">发货记录列表</h1>
<h1 class="page-sub-title" th:text="|共${page.total}条记录|"></h1>
<form id="listForm" th:action="|purchaseStock/list.html|" method="post">
<form id="listForm" th:action="|purchaseStock/list.html?pageType=${pageType}|" method="post">
<input type="hidden" name="displayMode" th:value="${displayMode}">
<div class="toolBar">
<input hidden name="pageType" th:value="${pageType}"/>