Commit 0702b624 by wuwenlong

采购计划bugfix;材料计划生成采购计划bugfix;

parent 4df7d620
...@@ -86,6 +86,7 @@ public enum DdynamicEnum { ...@@ -86,6 +86,7 @@ public enum DdynamicEnum {
*/ */
INVENT_RECORD_BLOCK_ID("invent_record_block_id","inventCode","inventName","inventType","spec","HGPZ005.queryComboBox"), INVENT_RECORD_BLOCK_ID("invent_record_block_id","inventCode","inventName","inventType","spec","HGPZ005.queryComboBox"),
/** /**
* 模块:存货档案 * 模块:存货档案
* 用途:存货档案下拉框 (不默认状态) * 用途:存货档案下拉框 (不默认状态)
......
...@@ -44,9 +44,13 @@ public class ServiceHGCG001 extends ServiceBase { ...@@ -44,9 +44,13 @@ public class ServiceHGCG001 extends ServiceBase {
@OperationLogAnnotation(operModul = "采购计划", operType = "查询", operDesc = "初始化") @OperationLogAnnotation(operModul = "采购计划", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
List<HGCG001> resultList = HGCGTools.HgCg001.listAll();
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.COMPANY_CODE_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID)); CommonMethod.objConvertComboBox(resultList,inInfo,DdynamicEnum.INVENT_RECORD_BLOCK_ID.getBlockId(),HGCG001.FIELD_INVENT_NAME,HGCG001.FIELD_INVENT_NAME);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID)); CommonMethod.distinctTextField(inInfo,DdynamicEnum.INVENT_RECORD_BLOCK_ID.getBlockId());
CommonMethod.objConvertComboBox(resultList,inInfo,DdynamicEnum.SPEC_NAME_BLOCK_ID.getBlockId(),HGCG001.FIELD_SPEC,HGCG001.FIELD_SPEC);
CommonMethod.distinctTextField(inInfo,DdynamicEnum.SPEC_NAME_BLOCK_ID.getBlockId());
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGCG001().eiMetadata);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......
...@@ -66,6 +66,9 @@ ...@@ -66,6 +66,9 @@
<isNotEmpty prepend=" AND " property="inventName"> <isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName# INVENT_NAME = #inventName#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="spec">
SPEC = #spec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="status"> <isNotEmpty prepend=" AND " property="status">
STATUS = #status# STATUS = #status#
</isNotEmpty> </isNotEmpty>
...@@ -90,7 +93,7 @@ ...@@ -90,7 +93,7 @@
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<include refid="BaseCondition.specCondition"/> <!-- <include refid="BaseCondition.specCondition"/>-->
<include refid="BaseCondition.createdTimeCondition"/> <include refid="BaseCondition.createdTimeCondition"/>
</sql> </sql>
......
...@@ -63,6 +63,16 @@ public class HGCGTools { ...@@ -63,6 +63,16 @@ public class HGCGTools {
/** /**
* 查询 * 查询
* *
* @return
*/
public static List<HGCG001> listAll() {
Map<String, Object> paramMap = new HashMap();
return DaoBase.getInstance().query(HGCG001.QUERY, paramMap);
}
/**
* 查询
*
* @param planNos * @param planNos
* @return * @return
*/ */
......
...@@ -6,6 +6,8 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -6,6 +6,8 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.cg.domain.HGCG001; import com.baosight.hggp.hg.cg.domain.HGCG001;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.pz.domain.HGPZ005;
import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
...@@ -16,12 +18,11 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -16,12 +18,11 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.List;
import java.util.Map;
/** /**
* *
...@@ -210,6 +211,15 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -210,6 +211,15 @@ public class ServiceHGSC009A extends ServiceBase {
try { try {
String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(","); String[] orderDetailIds = inInfo.getString("planMaterialCodes").split(",");
List<HGSC009A> hgsc009AList = HGSCTools.HGSC009.getById(orderDetailIds); List<HGSC009A> hgsc009AList = HGSCTools.HGSC009.getById(orderDetailIds);
List<String> inventCodes = Optional.ofNullable(hgsc009AList).orElse(new ArrayList<>()).stream().map(HGSC009A::getInventCode).collect(Collectors.toList());
Map<String,String> inventUnitMap = new HashMap<>();
if(CollectionUtils.isNotEmpty(inventCodes)){
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
if(CollectionUtils.isNotEmpty(hgpz005List)){
inventUnitMap = hgpz005List.stream().collect(Collectors.toMap(HGPZ005::getInventCode,HGPZ005::getUnit,(v1,v2)->v1));
}
}
for (HGSC009A hgsc009 : hgsc009AList) { for (HGSC009A hgsc009 : hgsc009AList) {
// 写入子表数据 // 写入子表数据
HGCG001 hgcg001 = new HGCG001(); HGCG001 hgcg001 = new HGCG001();
...@@ -226,9 +236,11 @@ public class ServiceHGSC009A extends ServiceBase { ...@@ -226,9 +236,11 @@ public class ServiceHGSC009A extends ServiceBase {
hgcg001.setThick(hgsc009.getThick()); hgcg001.setThick(hgsc009.getThick());
hgcg001.setStatus(0); hgcg001.setStatus(0);
hgcg001.setPlanDate(DateUtils.formatShort(DateUtils.date())); hgcg001.setPlanDate(DateUtils.formatShort(DateUtils.date()));
hgcg001.setPlanUnitWeight(hgsc009.getSingleWeight());//总量 hgcg001.setPlanUnitWeight(hgsc009.getSingleWeight());//单量
hgcg001.setPlanWeight(hgsc009.getGrossAmount());
hgcg001.setPlanQty(hgsc009.getQuantity());
hgcg001.setPlanNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_NO)); hgcg001.setPlanNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.CG_PLAN_NO));
hgcg001.setUnit(inventUnitMap.get(hgsc009.getInventCode()));
DaoUtils.insert(HGCG001.INSERT, hgcg001); DaoUtils.insert(HGCG001.INSERT, hgcg001);
} }
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -17,6 +17,7 @@ import org.apache.commons.collections.CollectionUtils; ...@@ -17,6 +17,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -330,6 +331,22 @@ public class CommonMethod { ...@@ -330,6 +331,22 @@ public class CommonMethod {
}); });
}}; }};
inInfo.getBlock(blockId).setRows(newRows); inInfo.getBlock(blockId).setRows(newRows);
}
public static void distinctTextField(EiInfo inInfo, String blockId){
List<Map<String, String>> rows = inInfo.getBlock(blockId).getRows();
List<Map<String, String>> newRows = rows.stream()
.collect(Collectors.collectingAndThen(
Collectors.toMap(
// Map的键
map -> map.get(HGConstants.TEXT_FIELD),
// Map的值
Function.identity(),
// 如果有重复的键,则选择第一个
(existing, replacement) -> existing),
// 将Map的值转换回List
map -> new ArrayList<>(map.values())
));
inInfo.getBlock(blockId).setRows(newRows);
} }
} }
...@@ -69,6 +69,10 @@ let save = function () { ...@@ -69,6 +69,10 @@ let save = function () {
message("勾选的第" + (i + 1) + "行采购重量必须是大于0的数字"); message("勾选的第" + (i + 1) + "行采购重量必须是大于0的数字");
return; return;
} }
if (rows[i]['status']!='0') {
message("勾选的第" + (i + 1) + "行采购计划已审核无法修改");
return;
}
} }
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () { ok: function () {
...@@ -86,6 +90,12 @@ let remove = function () { ...@@ -86,6 +90,12 @@ let remove = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
for (let i = 0; i < rows.length; i++) {
if (rows[i]['status']!='0') {
message("勾选的第" + (i + 1) + "行采购计划已审核无法删除");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "remove", true); JSUtils.submitGridsData("result", "HGCG001", "remove", true);
...@@ -102,6 +112,20 @@ let submit = function () { ...@@ -102,6 +112,20 @@ let submit = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
for (let i = 0; i < rows.length; i++) {
if (!isPositiveNumber(rows[i]['purQty'])) {
message("勾选的第" + (i + 1) + "行采购数量必须是大于0的数字");
return;
}
if (!isPositiveNumber(rows[i]['purWeight'])) {
message("勾选的第" + (i + 1) + "行采购重量必须是大于0的数字");
return;
}
if (rows[i]['status']!='0') {
message("勾选的第" + (i + 1) + "行采购计划已审核不能重复审核");
return;
}
}
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"审核\"操作? ", { JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"审核\"操作? ", {
ok: function () { ok: function () {
JSUtils.submitGridsData("result", "HGCG001", "submit", true); JSUtils.submitGridsData("result", "HGCG001", "submit", true);
......
...@@ -17,17 +17,17 @@ ...@@ -17,17 +17,17 @@
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部" <EF:EFSelect cname="状态" blockId="inqu_status" ename="status" row="0" colWidth="3" optionLabel="全部"
defultValue=""> defultValue="">
<EF:EFCodeOption codeName="hggp.hgcg.planStatus"/> <EF:EFCodeOption codeName="hggp.hgcg.planStatus" condition="ITEM_CODE IN ('0', '2', '4')"/>
</EF:EFSelect> </EF:EFSelect>
</div> </div>
<div class="row"> <div class="row">
<EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" <EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventName" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="invent_record_block_id" textField="textField" valueField="textField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFSelect cname="规格" blockId="inqu_status" ename="spec" row="0" colWidth="3" <EF:EFSelect cname="规格" blockId="inqu_status" ename="spec" row="0" colWidth="3"
filter="contains" optionLabel="全部" defultValue=""> filter="contains" optionLabel="全部" defultValue="">
<EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="valueField"/> <EF:EFOptions blockId="spec_name_block_id" textField="textField" valueField="textField"/>
</EF:EFSelect> </EF:EFSelect>
<EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status" <EF:EFDateSpan startCname="创建时间(从)" endCname="至" blockId="inqu_status"
startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime" startName="createdTimeFrom" endName="createdTimeTo" row="0" role="datetime"
...@@ -56,9 +56,9 @@ ...@@ -56,9 +56,9 @@
<EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="planWeight" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/> <EF:EFColumn ename="material" cname="材质" enable="false" width="80" align="center"/>
<EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/> <EF:EFColumn ename="unit" cname="单位" enable="false" width="80" align="center"/>
<EF:EFColumn ename="length" cname="长(M)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="length" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="width" cname="宽(M)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="thick" cname="厚(M)" enable="false" width="80" align="right" format="{0:N3}"/> <EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/> <EF:EFColumn ename="createdName" cname="创建人" enable="false" width="100" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center" <EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss']"/> editType="datetime" parseFormats="['yyyyMMddHHmmss']"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment