Commit cf068ec5 by liuyang

2024-09-29 委托加工

parent 91cdba6f
......@@ -9,6 +9,7 @@ import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sc.domain.HGSC010;
import com.baosight.hggp.hg.sc.domain.HGSC010A;
import com.baosight.hggp.hg.sc.domain.HGSC010B;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.xs.domain.Company;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
......@@ -21,6 +22,7 @@ import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author LiuYang
......@@ -122,16 +124,20 @@ public class ServiceHGSC010 extends ServiceEPBase {
public EiInfo updateStatus(EiInfo inInfo) {
int i = 0;
try {
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HGSC010 hgsc010 = new HGSC010();
hgsc010.fromMap(map);
List<HGSC010> resultMaps = MapUtils.toDaoEPBases(inInfo, HGSC010.class);
List<Long> ids = ObjectUtils.listEpKey(resultMaps, HGSC010.FIELD_ID);
List<HGSC010A> hgsc010As = HGSCTools.Hgsc010a.getByParentIds(ids);
List<HGSC010B> hgsc010Bs = HGSCTools.Hgsc010b.getByParentIds(ids);
for (HGSC010 hgsc010: resultMaps) {
List<HGSC010A> hgsc010AList = hgsc010As.stream().filter(item -> item.getParentId().equals(hgsc010.getId())).collect(Collectors.toList());
List<HGSC010B> hgsc010BList = hgsc010Bs.stream().filter(item -> item.getParentId().equals(hgsc010.getId())).collect(Collectors.toList());
AssertUtils.isTrue(hgsc010AList.size()<= 0 || hgsc010BList.size()<= 0, "请先添加成本委托明细或者原料委托明细");
hgsc010.setSubStatus(CommonConstant.YesNo.YES_1);
DaoUtils.update("HGSC010.updateBySubStatus", hgsc010.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.delete", "提交")});
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(resultMaps.size()), I18nMessages.getText("label.update", "提交")});
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "提交失败");
}
......
......@@ -108,6 +108,9 @@
<isNotEmpty prepend=" AND " property="remainingWeight">
REMAINING_WEIGHT = #remainingWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......
......@@ -108,6 +108,9 @@
<isNotEmpty prepend=" AND " property="remainingWeight">
REMAINING_WEIGHT = #remainingWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="parentIds">
PARENT_ID IN <iterate close=")" open="(" conjunction="," property="parentIds">#parentIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......
......@@ -1944,7 +1944,65 @@ public class HGSCTools {
public static HGSC010 getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委托加工ID不能为空!");
return (HGSC010)DaoBase.getInstance().get(HGSC010.QUERY, HGSC009.FIELD_ID, id);
return (HGSC010)DaoBase.getInstance().get(HGSC010.QUERY, HGSC010A.FIELD_ID, id);
}
}
public static class Hgsc010a {
public static HGSC010A getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委托加工ID不能为空!");
return (HGSC010A) DaoBase.getInstance().get(HGSC010A.QUERY, HGSC010A.FIELD_ID, id);
}
public static List<HGSC010A> getByParentId(Long parentId){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentId",parentId);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010A> list = DaoBase.getInstance().query(HGSC010A.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
public static List<HGSC010A> getByParentIds(List<Long> parentIds){
AssertUtils.isTrue(Objects.isNull(parentIds)||parentIds.size()<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentIds",parentIds);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010A> list = DaoBase.getInstance().query(HGSC010A.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
}
public static class Hgsc010b {
public static HGSC010B getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "委托加工ID不能为空!");
return (HGSC010B) DaoBase.getInstance().get(HGSC010B.QUERY, HGSC010B.FIELD_ID, id);
}
public static List<HGSC010B> getByParentId(Long parentId){
AssertUtils.isTrue(Objects.isNull(parentId)||parentId<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentId",parentId);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010B> list = DaoBase.getInstance().query(HGSC010B.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
public static List<HGSC010B> getByParentIds(List<Long> parentIds){
AssertUtils.isTrue(Objects.isNull(parentIds)||parentIds.size()<=0, "委托加工ID不能为空!");
Map queryMap = new HashMap<String,Object>(){{
put("parentIds",parentIds);
put("deleteFlag",CommonConstant.YesNo.NO_0);
}};
List<HGSC010B> list = DaoBase.getInstance().query(HGSC010B.QUERY, queryMap);
return CollectionUtils.isEmpty(list)? new ArrayList<>():list;
}
}
......
......@@ -165,7 +165,13 @@ function updateStatus() {
if (flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"提交\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC010", "updateStatus", true);
JSUtils.submitGridsData("result", "HGSC010", "updateStatus", true,
function (e) {
var status = e.getStatus();
if (status !== -1) {
query();
}
});
}
});
}
......
......@@ -24,17 +24,17 @@
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" needAuth="false">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="productCode" cname="成品编码" width="120" align="center" required="true" readonly="false"
blockName="invent_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="productName" cname="成品名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center"/>
<EF:EFColumn ename="pcsQty" cname="加工数量" width="120" enable="true" format="{0:N0}" editType="text"
......@@ -66,17 +66,17 @@
<EF:EFRegion id="detail" title="原料信息">
<EF:EFGrid blockId="detail" autoDraw="override" isFloat="true" needAuth="false" serviceName="HGSC010B">
<EF:EFColumn ename="id" primaryKey="true" cname="内码" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFComboColumn ename="inventCode" cname="原料编码" width="120" align="center" required="true" readonly="false"
blockName="invent_record_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="原料名称" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="100" align="center" required="true"
blockName="invent_type_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="spec" cname="规格" width="140" align="center" maxLength="50"/>
<EF:EFColumn ename="unit" cname="单位" width="80" align="center"/>
<EF:EFColumn ename="pcsQty" cname="加工数量" width="120" enable="true" format="{0:N0}" editType="text"
......
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