Commit cb73e8cb by yukang

生产订单/生产订单分派

parent 1d319492
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -7,7 +8,9 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.xservices.xs.og.domain.XSOG01;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -125,4 +128,42 @@ public class ServiceHPSC005 extends ServiceBase {
return eiInfo;
}
/**
* 分派
* @param eiInfo
* @return
*/
public EiInfo assign(EiInfo eiInfo) {
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String ids = eiInfo.get("ids").toString();
String orgId = eiInfo.get("orgId").toString();
//先找到分派的组织
Map map =(Map) dao.get("XSOG0801.queryByOrgId","orgId", orgId);
String [] id = ids.split(",");
for (int i = 0; i < id.length; i++) {
// 更新HPSC005的数据
HPSC005 HPSC005 = new HPSC005();
HPSC005.setId(NumberUtils.toLong(id[i]));
HPSC005.setStatus(1);
HPSC005.setOrgNo(map.get("orgId").toString());
HPSC005.setOrgName(map.get("orgCname").toString());
HPSC005.setUpdatedBy(UserSession.getUserId());
HPSC005.setUpdatedTime(sdf.format(new Date()));
this.dao.update("HPSC005.updateAssign", HPSC005.toMap());
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("分派成功!");
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("分派失败!原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("分派失败", e.getMessage());
return eiInfo;
}
return query(eiInfo);
}
}
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.xservices.xs.og.domain.XSOG01;
import java.util.HashMap;
import java.util.List;
/**
*
*/
public class ServiceHPSC098 extends ServiceBase {
/**
* 画面初始化.
*/
public EiInfo initLoad(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
outInfo.set("inqu_status-0-orgCname", inInfo.get("inqu_status-0-orgCname"));
outInfo = super.query(outInfo, "XSOG0801.queryOrgList", new XSOG01());
EiBlock r3Block = new EiBlock("result");
r3Block.setRows(outInfo.getBlock(EiConstant.resultBlock).getRows());
outInfo.addBlock(r3Block);
return outInfo;
}
@Override
public EiInfo query(EiInfo inInfo) {
XSOG01 XSOG01 = new XSOG01();
EiInfo outInfo = new EiInfo();
//添加返回到前台的块,块名和前台的对应
EiBlock eiBlock = outInfo.addBlock("result");
HashMap params = new HashMap();
params.put("orgCname",inInfo.get("inqu_status-0-orgCname"));
List list = dao.query("XSOG0801.queryOrgList",params,0,-999999);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(XSOG01.eiMetadata);
outInfo.addBlock(EiConstant.resultBlock).addRows(list);
outInfo.getBlock(EiConstant.resultBlock).set("limit", list.size());
return outInfo;
}
}
......@@ -275,4 +275,16 @@
ID = #id#
</update>
<update id="updateAssign">
UPDATE ${hpjxSchema}.T_HPSC005
SET
STATUS = #status#, <!-- 状态 0-未派工,1-已派工 -->
ORG_NO = #orgNo#, <!-- 生产组编码 -->
ORG_NAME = #orgName#, <!-- 生产组名称 -->
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_TIME = #updatedTime# <!-- 更新时间 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -653,6 +653,32 @@
</isNotEmpty>
</select>
<select id="queryOrgList" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT
ORG_ID as "orgId", <!-- 组织ID -->
ORG_ENAME as "orgEname", <!-- 组织编码 -->
ORG_CNAME as "orgCname", <!-- 组织名称 -->
ORG_BRIEF_NAME as "orgBriefName", <!-- 组织别名 -->
ORG_TYPE as "orgType", <!-- 组织类型 -->
PARENT_ORG_ID as "parentOrgId", <!-- 上级组织编码 -->
ESTABLISH_DATE as "establishDate", <!-- 成立日期 -->
ORG_LEVEL as "orgLevel", <!-- 组织级别 -->
SORT_INDEX as "sortIndex", <!-- 排序 -->
REC_CREATOR as "recCreator", <!-- 记录创建责任者 -->
REC_CREATE_TIME as "recCreateTime", <!-- 记录创建时刻 -->
REC_REVISOR as "recRevisor", <!-- 记录修改责任者 -->
REC_REVISE_TIME as "recReviseTime", <!-- 记录修改时刻 -->
ARCHIVE_FLAG as "archiveFlag", <!-- 归档标记 -->
ORG_NODE_TYPE as "orgNodeType", <!-- 节点类型 -->
IS_DELETED as "isDelete" <!-- 删除标记 -->
FROM ${platSchema}.TXSOG01 WHERE 1=1 AND IS_DELETED = '0'
AND ORG_TYPE != 'org'
<isNotEmpty prepend=" AND " property="orgCname">
ORG_CNAME LIKE ('%$orgCname$%')
</isNotEmpty>
</select>
<!-- 根据userId删除对应的用户-用户组记录-->
<delete id="deleteUserGroupMemberByUserId">
DELETE FROM ${platSchema}.XS_USER_GROUP_MEMBER
......
......@@ -27,15 +27,15 @@
<EF:EFRegion id="result" title="基本信息">
<EF:EFGrid blockId="result" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目号" readonly="true"/>
<EF:EFColumn ename="projName" cname="项目名称" readonly="true"/>
<EF:EFColumn ename="planInfoNo" cname="生产计划单号" readonly="true"/>
<EF:EFColumn ename="prdtCode" cname="产品编码" readonly="true"/>
<EF:EFColumn ename="prdtName" cname="产品名称" readonly="true"/>
<EF:EFColumn ename="planCompletionDate" cname="计划完成日期" editType="date" dateFormat="yyyy/MM/dd" width="150"
readonly="false" required='true'/>
<EF:EFColumn ename="schedule" cname="生产完工进度" format="{0:N2}" readonly="true"/>
<EF:EFComboColumn required="true" ename="status" cname="状态">
<EF:EFColumn enable="false" ename="projCode" cname="项目号" readonly="true"/>
<EF:EFColumn enable="false" ename="projName" cname="项目名称" readonly="true"/>
<EF:EFColumn enable="false" ename="planInfoNo" cname="生产计划单号" readonly="true"/>
<EF:EFColumn enable="false" ename="prdtCode" cname="产品编码" readonly="true"/>
<EF:EFColumn enable="false" ename="prdtName" cname="产品名称" readonly="true"/>
<EF:EFColumn enable="false" ename="planCompletionDate" cname="计划完成日期" editType="date" dateFormat="yyyy/MM/dd" width="150"
required='true'/>
<EF:EFColumn enable="false" ename="schedule" cname="生产完工进度" format="{0:N2}" readonly="true"/>
<EF:EFComboColumn enable="false" ename="status" cname="状态">
<EF:EFOption label="未审核" value="0"/>
<EF:EFOption label="已审核" value="1"/>
</EF:EFComboColumn>
......@@ -47,22 +47,22 @@
<EF:EFRegion id="detail" title="明细信息">
<EF:EFGrid blockId="detail" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="prdtCode" required='true' cname="部件编码"/>
<EF:EFColumn ename="prdtName" readonly="true" cname="部件名称"/>
<EF:EFComboColumn required="true" ename="delStatus" cname="状态">
<EF:EFColumn enable="false" ename="prdtCode" required='true' cname="部件编码"/>
<EF:EFColumn enable="false" ename="prdtName" readonly="true" cname="部件名称"/>
<EF:EFComboColumn enable="false" ename="delStatus" cname="状态">
<EF:EFOption label="已删除" value="0"/>
<EF:EFOption label="启用" value="1"/>
</EF:EFComboColumn>
<EF:EFColumn ename="num" readonly="true" cname="计划数量"/>
<EF:EFColumn ename="unitWt" readonly="true" cname="计划重量"/>
<EF:EFColumn enable="false" ename="num" readonly="true" cname="计划数量"/>
<EF:EFColumn enable="false" ename="unitWt" readonly="true" cname="计划重量"/>
<EF:EFColumn ename="planCommentDate" cname="计划开始时间" editType="date" dateFormat="yyyy/MM/dd" width="150"
readonly="false" />
/>
<EF:EFColumn ename="planCompletionDate" cname="计划结束时间" editType="date" dateFormat="yyyy/MM/dd" width="150"
readonly="false" />
/>
<EF:EFColumn ename="actualCompletionDate" cname="实际完成时间" editType="date" dateFormat="yyyy/MM/dd" width="150"
readonly="true"/>
<EF:EFColumn ename="actualCompletionNum" cname="实际完工数量" readonly="true"/>
<EF:EFColumn ename="actualCompletionUnitWt" cname="实际完工重量" readonly="true"/>
enable="false"/>
<EF:EFColumn enable="false" ename="actualCompletionNum" cname="实际完工数量" readonly="true"/>
<EF:EFColumn enable="false" ename="actualCompletionUnitWt" cname="实际完工重量" readonly="true"/>
<EF:EFColumn ename="operator" cname="操作" width="100" enable="false" readonly="false"/>
</EF:EFGrid>
</EF:EFRegion>
......
let ids = [];
$(function () {
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
$("#ASSIGN").on("click", function () {
//重置全局变量
ids = [];
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要分派的数据");
return;
}
let num = 0;
rows.forEach(function(element) {
if (element.status == 1) {
num++;
}
ids.push(element.id)
});
if (num > 0) {
message("勾选的数据中有已经分派的数据!");
return;
} else {
JSColorbox.open({
href: "HPSC098?methodName=initLoad",
title: "<div style='text-align: center;'>选择组织</div>",
width: "40%",
height: "70%",
callbackName: assignCallback
});
}
});
IPLATUI.EFGrid.result = {
......@@ -30,3 +59,26 @@ $(function () {
}
});
let assignCallback = function (orgId) {
var info = new EiInfo()
info.set("ids",ids.join(','));
info.set("orgId",orgId);
EiCommunicator.send("HPSC005","assign",info,{
onSuccess:function(ei){//返回结果集
if (ei["status"] == -1) {
NotificationUtil(ei, "error");
} else {
NotificationUtil({
msg: '修改成功'
});
// 刷新列表
resultGrid.dataSource.page(1);
// 关闭弹窗
JSColorbox.close();
}
},onFail:function(ei){}
},{async:false});
}
\ No newline at end of file
......@@ -28,21 +28,23 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目号"/>
<EF:EFColumn ename="projName" cname="项目名称"/>
<EF:EFColumn ename="productionOrderNo" cname="生产订单号"/>
<EF:EFColumn ename="prdtCode" cname="部件编码"/>
<EF:EFColumn ename="prdtName" cname="部件名称"/>
<EF:EFColumn ename="planCompletionDate" cname="计划完成日期"/>
<EF:EFColumn ename="num" cname="计划数量"/>
<EF:EFColumn ename="totalWt" cname="计划重量"/>
<EF:EFComboColumn required="true" align="center" ename="status" cname="状态">
<EF:EFColumn enable="false" ename="projCode" cname="项目号" />
<EF:EFColumn enable="false" ename="projName" cname="项目名称"/>
<EF:EFColumn enable="false" ename="productionOrderNo" cname="生产订单号"/>
<EF:EFColumn enable="false" ename="prdtCode" cname="部件编码"/>
<EF:EFColumn enable="false" ename="prdtName" cname="部件名称"/>
<EF:EFColumn enable="false" ename="planCompletionDate" cname="计划完成日期"/>
<EF:EFColumn enable="false" ename="num" cname="计划数量"/>
<EF:EFColumn enable="false" ename="totalWt" cname="计划重量"/>
<EF:EFComboColumn enable="false" align="center" ename="status" cname="状态">
<EF:EFOption label="未派工" value="0"/>
<EF:EFOption label="已派工" value="1"/>
</EF:EFComboColumn>
<EF:EFColumn ename="orgName" cname="生产组"/>
<EF:EFColumn enable="false" ename="orgName" cname="生产组"/>
<EF:EFColumn ename="operator" cname="操作" width="100" enable="false" readonly="false"/>
</EF:EFGrid>
</EF:EFRegion>
......
$(function () {
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
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];
JSUtils.confirm("确定\"保存\"操作? ", {
ok: function () {
parent.JSColorbox.setValueCallback(row.orgId);
}
});
});
});
\ No newline at end of file
<!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="查询条件">
<div class="row">
<EF:EFInput ename="orgCname" cname="组织名称" blockId="inqu_status" row="0"/>
</div>
<EF:EFButton ename="QUERY" cname="查询" row="1" class="btn-align-right"></EF:EFButton>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="orgId" cname="内码" hidden="true"/>
<EF:EFColumn ename="orgEname" cname="组织编码" enable="false" width="130" align="center"/>
<EF:EFColumn cname="组织名称" ename="orgCname" width="100" readonly="false" align="center"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
<script>
var ctx = "${ctx}";
</script>
<script src="${ctx}/HP/SC/HPSC098.js"></script>
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