Commit 8723dd58 by wuwenlong

生产计划bugfix,生产订单派工dev;

parent 48e51a46
......@@ -35,7 +35,16 @@ public enum ProductTypeEnum {
block.setRows(rows);
return block;
}
public static ProductTypeEnum getEnumByCode(Integer code){
for (ProductTypeEnum en : ProductTypeEnum.values()){
if(code.compareTo(en.code)==0){
return en;
}
}
return null;
}
public Integer getCode() {
return code;
}
......
......@@ -95,7 +95,7 @@
<isNotEmpty prepend=" AND " property="flowId">
FLOW_ID = #flowId#
</isNotEmpty>
<isNotEmpty property="inventCodes">
<isNotEmpty prepend=" AND " property="inventCodes">
INVENT_CODE IN <iterate close=")" open="(" conjunction="," property="inventCodes">#inventCodes[]#</iterate>
</isNotEmpty>
</sql>
......
......@@ -81,7 +81,7 @@
<isNotEmpty prepend=" AND " property="parentId">
PARENT_ID = #parentId#
</isNotEmpty>
<isNotEmpty property="ids">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
</sql>
......
package com.baosight.hggp.hg.sc.domain;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.core.ei.EiColumn;
import com.baosight.iplat4j.core.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
public class HGSC098 extends DaoEPBase {
private String factoryCode = " "; /* 厂区编码*/
private String factoryName = " "; /* 工厂*/
private String groupCode = " "; /* 组织编码*/
private String groupName = " "; /* 组织名称 */
/**
* initialize the metadata
*/
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn("factoryCode");
eiColumn.setDescName("厂区编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("factoryName");
eiColumn.setDescName("工厂");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("groupCode");
eiColumn.setDescName("组织编码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("groupName");
eiColumn.setDescName("组织名称");
eiMetadata.addMeta(eiColumn);
}
/**
* the constructor
*/
public HGSC098() {
initMetaData();
}
public String getFactoryCode() {
return factoryCode;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryName() {
return factoryName;
}
public void setFactoryName(String factoryName) {
this.factoryName = factoryName;
}
public String getGroupCode() {
return groupCode;
}
public void setGroupCode(String groupCode) {
this.groupCode = groupCode;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
/**
* get the value from Map
*/
public void fromMap(Map map) {
setFactoryCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("factoryCode")), factoryCode));
setFactoryName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("factoryName")), factoryName));
setGroupCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("groupCode")), groupCode));
setGroupName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get("groupName")), groupName));
}
/**
* set the value to Map
*/
public Map toMap() {
Map map = new HashMap();
map.put("factoryCode",StringUtils.toString(factoryCode, eiMetadata.getMeta("factoryCode")));
map.put("factoryName",StringUtils.toString(factoryName, eiMetadata.getMeta("factoryName")));
map.put("groupCode",StringUtils.toString(groupCode, eiMetadata.getMeta("groupCode")));
map.put("groupName",StringUtils.toString(groupName, eiMetadata.getMeta("groupName")));
return map;
}
}
......@@ -29,6 +29,7 @@ public class ServiceHGSC005A extends ServiceBase {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.PLAN_PROCESS_BLOCK_ID), new HashMap<String, Object>(){{
put(HGSC005A.FIELD_plan_code,planCode);
}},false);
CommonMethod.comboBoxDefaultValue(inInfo,DdynamicEnum.PLAN_PROCESS_BLOCK_ID.getBlockId(),"全部");
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
......@@ -79,7 +80,7 @@ public class ServiceHGSC005A extends ServiceBase {
@OperationLogAnnotation(operModul = "生产计划详情", operType = "排产", operDesc = "排产")
public EiInfo schedule(EiInfo inInfo) {
try {
String planCode = inInfo.getString(HGSC005.FIELD_plan_code);
String planCode = inInfo.getString("inqu_status-0-planCode");
HGSC005 hgsc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(hgsc005);
int count = HGSCTools.THGSC005A.schedule(planCode);
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.enums.OrgTypeEnum;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.sc.domain.HGSC001;
import com.baosight.hggp.hg.sc.domain.HGSC098;
import com.baosight.hggp.hg.xs.domain.Dept;
import com.baosight.hggp.hg.xs.domain.Org;
import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import org.apache.commons.collections.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
*
*/
public class ServiceHGSC098 extends ServiceBase {
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "组织机构",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
//查询项目所属公司下面的所有厂区
String companyCode = inInfo.getString("inqu_status-0-companyCode");
String productType = inInfo.getString("inqu_status-0-productType");
List<Org> orgList = HGXSTools.XsOrg.queryByParent(companyCode, OrgTypeEnum.FACTORY.getCode());
EiInfoUtils.addBlock(inInfo,"factory_record_block_id", orgList, Org.class);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGSC098().eiMetadata);
inInfo.set("inqu_status-0-productType", productType);
} catch (PlatException | InstantiationException | IllegalAccessException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "组织机构",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
//查询项目所属公司下面的所有厂区
String companyCode = inInfo.getString("inqu_status-0-companyCode");
String productType = inInfo.getString("inqu_status-0-productType");
List<Org> orgList = HGXSTools.XsOrg.queryByParent(companyCode, OrgTypeEnum.FACTORY.getCode());
if(CollectionUtils.isNotEmpty(orgList)) {
inInfo.set("inqu_status-0-companyCode", null);
List<String> factoryCodes = orgList.stream().map(Org::getFactoryCode).collect(Collectors.toList());
inInfo.set("inqu_status-0-factoryCodes", factoryCodes);
ProductTypeEnum productTypeEnum = ProductTypeEnum.getEnumByCode(Integer.valueOf(productType));
OrgTypeEnum orgType;
switch (productTypeEnum) {
case STRUCT:
orgType = OrgTypeEnum.PROD_GROUP;
break;
case PART:
orgType = OrgTypeEnum.CUT_GROUP;
break;
default:
throw new PlatException("产品类型异常!");
}
inInfo.set("inqu_status-0-orgType", orgType.getCode());
inInfo = super.query(inInfo, "HGSC098.query", new HGSC098());
}
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
/**
* 部门下拉框
* @param inInfo
* @return
*/
public EiInfo workGroupComboBox(EiInfo inInfo){
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String factoryCode = MapUtils.getString(queryMap, "factoryCode");
String productType = inInfo.getString("inqu_status-0-productType");
ProductTypeEnum productTypeEnum = ProductTypeEnum.getEnumByCode(Integer.valueOf(productType));
OrgTypeEnum orgType;
switch (productTypeEnum){
case STRUCT:
orgType = OrgTypeEnum.PROD_GROUP;
break;
case PART:
orgType = OrgTypeEnum.CUT_GROUP;
break;
default:
throw new PlatException("产品类型异常!");
}
List<Org> orgList = HGXSTools.XsOrg.queryByParent(factoryCode, orgType.getCode());
EiInfoUtils.addBlock(inInfo,"workGroup", orgList, Org.class);
CommonMethod.comboBoxDefaultValue(inInfo,"depByCompany","orgEname","orgCname");
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
return inInfo;
}
}
......@@ -44,10 +44,10 @@
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name like ('%projName%')
proj_name like ('%$projName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="planCode">
plan_code = like ('%planCode%')
plan_code like ('%$planCode$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="commitStatus">
commit_status = #commitStatus#
......
......@@ -95,7 +95,7 @@
product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
product_name like ('%productName%')
product_name like ('%$productName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="finishDate">
finish_date = #finishDate#
......@@ -136,7 +136,7 @@
<isNotEmpty prepend=" AND " property="updatedTime">
updated_time = #updatedTime#
</isNotEmpty>
<isNotEmpty property="planCodes">
<isNotEmpty prepend=" AND " property="planCodes">
plan_code IN <iterate close=")" open="(" conjunction="," property="planCodes">#planCodes[]#</iterate>
</isNotEmpty>
</sql>
......
......@@ -46,10 +46,10 @@
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name like ('%projName%')
proj_name like ('%$projName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderCode">
order_code like ('%orderCode%')
order_code like ('%$orderCode$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="assignStatus">
assign_status = #assignStatus#
......
......@@ -85,7 +85,7 @@
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
proj_name like ('%projName%')
proj_name like ('%$projName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="orderCode">
order_code = #orderCode#
......@@ -97,7 +97,7 @@
product_code = #productCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="productName">
product_name like ('%productName%')
product_name like ('%$productName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="assignDate">
assign_date = #assignDate#
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HPSC098">
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hpjx.hp.sc.domain.HPSC098">
SELECT
ORG_ENAME AS "groupCode",
ORG_CNAME AS "groupName",
COMPANY_CODE AS "companyCode",
COMPANY_NAME AS "companyName"
FROM iplat.TXSOG01
WHERE 1 = 1 AND IS_DELETED = 0
AND ACCOUNTT_CODE = #accountCode#
<isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE = #orgType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
ORG_ENAME = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND" property="factoryCodes">
FACTORY_CODE IN <iterate close=")" open="(" conjunction="," property="factoryCodes">#factoryCodes[]#</iterate>
</isNotEmpty>
</select>
<select id="count" resultClass="int">
SELECT
COUNT(*)
FROM iplat.TXSOG01
WHERE 1 = 1
FROM iplat.TXSOG01
WHERE 1 = 1 AND IS_DELETED = 0
AND ACCOUNTT_CODE = #accountCode#
<isNotEmpty prepend=" AND " property="orgType">
ORG_TYPE = #orgType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
ORG_ENAME = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND" property="factoryCodes">
FACTORY_CODE IN <iterate close=")" open="(" conjunction="," property="factoryCodes">#factoryCodes[]#</iterate>
</isNotEmpty>
</select>
</sqlMap>
......@@ -165,7 +165,7 @@ public class HGSCTools {
}
public static HGSC005 queryByPlanCode(String planCode){
AssertUtils.isEmpty(planCode, "物料清单ID不能为空!");
AssertUtils.isEmpty(planCode, "计划编码不能为空!");
HGSC005 result = (HGSC005) DaoBase.getInstance().get(HGSC005.QUERY, HGSC005.FIELD_plan_code, planCode);
return result;
}
......
......@@ -115,7 +115,7 @@
<isNotEmpty prepend=" AND " property="processNames">
PROCESS_NAME LIKE CONCAT('%', #processNames#, '%')
</isNotEmpty>
<isNotEmpty property="processCodes">
<isNotEmpty prepend=" AND " property="processCodes">
PROCESS_CODE IN <iterate close=")" open="(" conjunction="," property="processCodes">#processCodes[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="computeType">
......
......@@ -273,12 +273,21 @@ public class CommonMethod {
comboBoxDefaultValue(inInfo,blockId,HGConstants.VALUE_FIELD,HGConstants.TEXT_FIELD);
}
public static void comboBoxDefaultValue(EiInfo inInfo, String blockId, String defaultText) {
comboBoxDefaultValue(inInfo,blockId,HGConstants.VALUE_FIELD,HGConstants.TEXT_FIELD,defaultText);
}
public static void comboBoxDefaultValue(EiInfo inInfo, String blockId, String valueFieldName, String textFieldName) {
String defaultText = "-- 请选择 --";
comboBoxDefaultValue(inInfo,blockId,HGConstants.VALUE_FIELD,HGConstants.TEXT_FIELD,defaultText);
}
public static void comboBoxDefaultValue(EiInfo inInfo, String blockId, String valueFieldName, String textFieldName, String defaultText) {
List rows = inInfo.getBlock(blockId).getRows();
List newRows = new ArrayList(){{
add(new HashMap<String,Object>(){{
put(valueFieldName,"");
put(textFieldName,"-- 请选择 --");
put(textFieldName,defaultText);
}});
}};
newRows.addAll(rows);
......
......@@ -15,7 +15,7 @@ $(function () {
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="showInfo(' + item.planCode + ')" >计划详情</a>';
'onclick="showInfo(\'' + item.planCode + '\')" >计划详情</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.matId + ')" >附件详情</a>';
return template;
......
......@@ -29,7 +29,7 @@
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="100" align="center" />
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="true" width="160" align="center" />
<EF:EFColumn ename="companyName" cname="公司名称" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="true" width="120" align="center" readOnly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" width="120" enable="true" align="center" readOnly="true"/>
......
......@@ -15,7 +15,7 @@
<div class="row">
<EF:EFInput ename="inqu_status-0-planCode" cname="计划编码" type="hidden"/>
<EF:EFInput ename="inqu_status-0-productName" cname="产品名称" colWidth="3"/>
<EF:EFSelect cname="工序" ename="result-0-processName" colWidth="3" required="true" filter="contains">
<EF:EFSelect cname="工序" ename="inqu_status-0-processName" colWidth="3" filter="contains">
<EF:EFOptions blockId="plan_process_block_id" valueField="valueField" textField="textField"/>
</EF:EFSelect>
<EF:EFDatePicker cname="交货日期" ename="inqu_status-0-finishDate" colWidth="3"
......
......@@ -25,6 +25,9 @@ $(function () {
loadComplete: function(grid) {
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
......
......@@ -13,12 +13,19 @@ $(function () {
columns: [{
field: "operator",
template: function (item) {
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
let template = "";
if(item.unassignQuantity > 0 ){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="separateAssign(\'' + item.id + '\')" >拆单派工</a>';
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' +
'onclick="showTaskInfo(' + item.id + ')" >任务详情</a>';
return template;
}
}],
loadComplete: function(grid) {
// 批量分派
$("#ASSIGN").on("click", assign);
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
......@@ -29,6 +36,58 @@ $(function () {
});
/**
* 批量分派
*/
function assign() {
//重置全局变量
ids = [];
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要分派的数据");
return;
}
let companyCode = rows[0].companyCode;
JSColorbox.open({
href: "HPSC098?methodName=initLoad&inqu_status-0-companyCode="+companyCode,
title: "<div style='text-align: center;'>选择组织</div>",
width: "70%",
height: "70%",
callbackName: function (row) {
var info = new EiInfo()
info.set("ids",ids.join(','));
info.set("factoryCode",row.factoryCode);
info.set("factoryName",row.factoryName);
info.set("groupCode",row.groupCode);
info.set("groupName",row.groupName);
EiCommunicator.send("HPSC006A", "assign", info, {
onSuccess: function (ei) {
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: ei.msg
});
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
}, onFail: function (ei) {
}
}, {async: false});
}
});
}
function separateAssign(id){
}
function showTaskInfo(orderDetailId) {
// JSColorbox.open({
// href: "HGSC007?methodName=initLoad&inqu_status-0-orderDetailId=" + orderDetailId + "&efParentFormEname=HGSC006A",
......
$(function () {
// 查询
$("#QUERY").on("click", query);
IPLATUI.EFGrid = {
"result": {
pageable: {
input: true,
numeric: false,
pageSize: 15,
position: 'top',
pageSizes: [15, 50, 100, 200]
},
columns: []
}
}
$("#CONFIRM").on("click", function () {
let rows = resultGrid.getCheckedRows()
console.log(rows)
if (rows.length != 1) {
message("请选择一条数据 ");
return;
}
let row = rows[0];
let isInput= decodeURI(window.location.href.split("&")[1]);
if(isInput==="isInput"){
parent.JSColorbox.setValueCallback(row);
return;
};
JSUtils.confirm("确定分派? ", {
ok: function () {
parent.JSColorbox.setValueCallback(row);
}
});
});
});
$(window).load(function () {
// 查询
query();
});
let query = function () {
resultGrid.dataSource.page(1);
}
\ No newline at end of file
HPSC098.js<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="组织机构">
<EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput cname="公司编码" ename="companyCode" blockId="inqu_status" row="0" type="hidden"/>
<EF:EFInput cname="产品类型" ename="productType" blockId="inqu_status" row="0" type="hidden"/>
<div class="row">
<EF:EFSelect ename="inqu_status-0-factoryCode" cname="工厂" colWidth="3" filter="contains"
template="#=textField#" valueTemplate="#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="factory_record_block_id" textField="factoryName" valueField="factoryCode"/>
</EF:EFSelect>
<EF:EFCascadeSelect cascadeFrom="result-0-companyCode" cname="工作组" ename="result-0-depCode"
colWidth="4" required="true" filter="contains" defaultValue=""
serviceName="HGSC098" methodName="workGroupComboBox" resultId="workGroup"
textField="orgCname" valueField="orgEname" >
</EF:EFCascadeSelect>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="single,row">
<EF:EFColumn ename="factoryCode" cname="厂区编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="factoryName" cname="工厂" enable="false" width="120" align="center" />
<EF:EFColumn ename="groupCode" cname="组织编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="groupName" cname="工作组" enable="false" width="120" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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