Compare commits

..

4 Commits

10 changed files with 56 additions and 16 deletions

View File

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

View File

@@ -481,7 +481,7 @@ public class MaterialOrderController extends BaseController {
return RespData.error("阶段不能为空"); return RespData.error("阶段不能为空");
} }
if (ignoreLineAccount == null) { 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 hasPurchaseOrder;
/** 匹配忽略管线号、隔热代号 */ /** 匹配忽略单元号、管线号、隔热代号 */
private Boolean ignoreLineAccount; private Boolean ignoreLineAccount;
public String getName() { public String getName() {

View File

@@ -674,7 +674,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
+"_"+materialOrderItem.getMemo()+"_"+materialOrderItem.getSize() +"_"+materialOrderItem.getMemo()+"_"+materialOrderItem.getSize()
+"_"+materialOrderItem.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getInsulationCode()) +"_"+materialOrderItem.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getInsulationCode())
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getLineAccount()) +"_"+materialOrderItem.getAreaAccount() +"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getLineAccount()) +"_"+materialOrderItem.getAreaAccount()
+"_"+materialOrderItem.getSiteAccount()+"_"+materialOrderItem.getUnitAccount() +"_"+materialOrderItem.getSiteAccount()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(ignoreLineAccount, materialOrderItem.getUnitAccount())
+"_"+materialOrderItem.getProductCode()+"_"+materialOrderItem.getPurchaseCode() +"_"+materialOrderItem.getProductCode()+"_"+materialOrderItem.getPurchaseCode()
+"_"+materialOrderItem.getMakeCode()+"_"+materialOrderItem.getMaterialType() +"_"+materialOrderItem.getMakeCode()+"_"+materialOrderItem.getMaterialType()
+"_"+materialOrderItem.getEndFace()+"_"+materialOrderItem.getPressureLevel(); +"_"+materialOrderItem.getEndFace()+"_"+materialOrderItem.getPressureLevel();
@@ -686,6 +686,13 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
countMap.put(str,count); 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()); 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))); Integer ind = Integer.valueOf(ExcelUtil2.getCellValue(row.getCell(0)));
String name = ExcelUtil2.getCellValue(row.getCell(1)); String name = ExcelUtil2.getCellValue(row.getCell(1));
String areaAccount = ExcelUtil2.getCellValue(row.getCell(2)); 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 siteAccount = ExcelUtil2.getCellValue(row.getCell(4));
String lineAccount = BooleanUtils.isTrue(ignoreLineAccount) ? "-" : ExcelUtil2.getCellValue(row.getCell(5)); String lineAccount = BooleanUtils.isTrue(ignoreLineAccount) ? "-" : ExcelUtil2.getCellValue(row.getCell(5));
String codeType = ExcelUtil2.getCellValue(row.getCell(6)); String codeType = ExcelUtil2.getCellValue(row.getCell(6));
@@ -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.setTotalCount(orderCount);
materialOrder.setTotalWeight(orderWeight); materialOrder.setTotalWeight(orderWeight);
update(materialOrder); update(materialOrder);
@@ -1208,6 +1222,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
lm.put("line",item.get("line")); lm.put("line",item.get("line"));
lm.put("code",item.get("code")); lm.put("code",item.get("code"));
lm.put("longDescription", item.get("longDescription")); 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("needCount", item.get("needCount"));
lm.put("preCount", item.get("preCount")); lm.put("preCount", item.get("preCount"));
lm.put("errorMessage", item.get("errorMessage")); lm.put("errorMessage", item.get("errorMessage"));
@@ -1241,7 +1258,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
+"_"+prevItem.getMemo()+"_"+prevItem.getSize() +"_"+prevItem.getMemo()+"_"+prevItem.getSize()
+"_"+prevItem.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getInsulationCode()) +"_"+prevItem.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getInsulationCode())
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getLineAccount()) +"_"+prevItem.getAreaAccount() +"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getLineAccount()) +"_"+prevItem.getAreaAccount()
+"_"+prevItem.getSiteAccount()+"_"+prevItem.getUnitAccount() +"_"+prevItem.getSiteAccount()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), prevItem.getUnitAccount())
+"_"+prevItem.getProductCode()+"_"+prevItem.getPurchaseCode() +"_"+prevItem.getProductCode()+"_"+prevItem.getPurchaseCode()
+"_"+prevItem.getMakeCode()+"_"+prevItem.getMaterialType() +"_"+prevItem.getMakeCode()+"_"+prevItem.getMaterialType()
+"_"+prevItem.getEndFace()+"_"+prevItem.getPressureLevel(); +"_"+prevItem.getEndFace()+"_"+prevItem.getPressureLevel();
@@ -1254,6 +1271,13 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
prevMapM.put(str,prevItem); 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()); List<MaterialOrderItem> itemList = materialOrderItemService.findByVersionNum(materialOrder.getVersionNum(), materialOrder.getId());
@@ -1271,7 +1295,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
+"_"+item.getMemo()+"_"+item.getSize() +"_"+item.getMemo()+"_"+item.getSize()
+"_"+item.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getInsulationCode()) +"_"+item.getSpecialRequest()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getInsulationCode())
+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getLineAccount()) +"_"+item.getAreaAccount() +"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getLineAccount()) +"_"+item.getAreaAccount()
+"_"+item.getSiteAccount()+"_"+item.getUnitAccount() +"_"+item.getSiteAccount()+"_"+ MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), item.getUnitAccount())
+"_"+item.getProductCode()+"_"+item.getPurchaseCode() +"_"+item.getProductCode()+"_"+item.getPurchaseCode()
+"_"+item.getMakeCode()+"_"+item.getMaterialType() +"_"+item.getMakeCode()+"_"+item.getMaterialType()
+"_"+item.getEndFace()+"_"+item.getPressureLevel(); +"_"+item.getEndFace()+"_"+item.getPressureLevel();
@@ -1288,9 +1312,16 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line",item.getLineAccount()); map.put("line",item.getLineAccount());
map.put("code",item.getProductCode()); map.put("code",item.getProductCode());
map.put("longDescription",item.getLongDescription()); 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("needCount",item.getNeedCount());
map.put("preCount",prevCount); map.put("preCount",prevCount);
if(Objects.equals(item.getNeedCount(), new BigDecimal("0.000"))){
map.put("errorMessage","以往阶段已采购,当前阶段没有采购");
} else {
map.put("errorMessage","当前阶段较以往阶段采购数量减少"); map.put("errorMessage","当前阶段较以往阶段采购数量减少");
}
specialList.add(map); specialList.add(map);
} else if (prevCount.compareTo(item.getNeedCount()) < 0) { } else if (prevCount.compareTo(item.getNeedCount()) < 0) {
map = new HashMap<>(); map = new HashMap<>();
@@ -1301,6 +1332,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line",item.getLineAccount()); map.put("line",item.getLineAccount());
map.put("code",item.getProductCode()); map.put("code",item.getProductCode());
map.put("longDescription",item.getLongDescription()); 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("needCount",item.getNeedCount());
map.put("preCount",prevCount); map.put("preCount",prevCount);
map.put("errorMessage","当前阶段较以往阶段采购数量增加"); map.put("errorMessage","当前阶段较以往阶段采购数量增加");
@@ -1317,6 +1351,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line",item.getLineAccount()); map.put("line",item.getLineAccount());
map.put("code",item.getProductCode()); map.put("code",item.getProductCode());
map.put("longDescription",item.getLongDescription()); 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("needCount",item.getNeedCount());
map.put("preCount",' '); map.put("preCount",' ');
map.put("errorMessage","当前阶段料单新增采购"); map.put("errorMessage","当前阶段料单新增采购");
@@ -1352,7 +1389,7 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
materialOrderItem.setProductId(entry.getValue().getProductId()); materialOrderItem.setProductId(entry.getValue().getProductId());
materialOrderItem.setName(entry.getValue().getName()); materialOrderItem.setName(entry.getValue().getName());
materialOrderItem.setAreaAccount(entry.getValue().getAreaAccount()); 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.setSiteAccount(entry.getValue().getSiteAccount());
materialOrderItem.setLineAccount(MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getLineAccount())); materialOrderItem.setLineAccount(MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getLineAccount()));
materialOrderItem.setCodeType(entry.getValue().getCodeType()); materialOrderItem.setCodeType(entry.getValue().getCodeType());
@@ -1393,6 +1430,9 @@ public class MaterialOrderService extends BaseOrderService<MaterialOrder, Long>
map.put("line", MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getLineAccount())); map.put("line", MaterialOrderItemConsts.getPrevStageLineAccount(materialOrder.getIgnoreLineAccount(), entry.getValue().getLineAccount()));
map.put("code",entry.getValue().getProductCode()); map.put("code",entry.getValue().getProductCode());
map.put("longDescription",entry.getValue().getLongDescription()); 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("needCount",' ');
map.put("preCount",prevMap.get(entry.getKey())); map.put("preCount",prevMap.get(entry.getKey()));
map.put("errorMessage","以往阶段已采购,当前阶段没有采购"); map.put("errorMessage","以往阶段已采购,当前阶段没有采购");

View File

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

View File

@@ -5,7 +5,7 @@
<div class="appPage listPage"> <div class="appPage listPage">
<h1 class="page-title">发货记录列表</h1> <h1 class="page-title">发货记录列表</h1>
<h1 class="page-sub-title" th:text="|共${page.total}条记录|"></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}"> <input type="hidden" name="displayMode" th:value="${displayMode}">
<div class="toolBar"> <div class="toolBar">
<input hidden name="pageType" th:value="${pageType}"/> <input hidden name="pageType" th:value="${pageType}"/>