Commit 9daa8b3e by 宋祥

1.按查询内容进行排产

parent 168269f2
......@@ -119,10 +119,11 @@ public class ServiceHGSC005A extends ServiceBase {
public EiInfo schedule(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String processName = MapUtils.getString(queryMap, "processName");
String planCode = MapUtils.getString(queryMap, "planCode");
HGSC005 dbSc005 = HGSCTools.THGSC005.queryByPlanCode(planCode);
this.checkScheduleData(dbSc005);
int count = HGSCTools.THGSC005A.schedule(planCode);
int count = HGSCTools.THGSC005A.schedule(planCode, processName);
dbSc005.setIsSchedule(CommonConstant.YesNo.YES_1);
DaoUtils.update(HGSC005.UPDATE, dbSc005);
inInfo = this.query(inInfo);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information
Generate time : 2024-05-17 17:15:03
Version : 1.0
schema : hggp
tableName : HGSC005A
id BIGINT NOT NULL primarykey,
mat_id BIGINT NOT NULL,
mat_detail_id BIGINT NOT NULL,
tech_flow_id BIGINT,
tech_flow_name BIGINT,
invent_process_id BIGINT,
process_name VARCHAR,
company_code VARCHAR NOT NULL,
company_name VARCHAR NOT NULL,
dep_code VARCHAR,
dep_name VARCHAR,
proj_code VARCHAR,
proj_name VARCHAR,
plan_code VARCHAR,
product_type TINYINT,
product_code VARCHAR,
product_name VARCHAR,
finish_date VARCHAR,
plan_start_date VARCHAR,
plan_end_date VARCHAR,
quantity TINYINT,
finish_quantity TINYINT,
unfinish_quantity TINYINT,
account_code VARCHAR NOT NULL,
created_by VARCHAR,
created_name VARCHAR,
created_time VARCHAR,
updated_by VARCHAR,
updated_name VARCHAR,
updated_time VARCHAR
-->
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="HGSC005A">
<sql id="condition">
<!--<include refid="HGXSDataAuth.authCondition"/>-->
<isNotEmpty prepend=" AND " property="id">
id = #id#
</isNotEmpty>
......@@ -156,8 +120,7 @@
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A">
<select id="query" resultClass="com.baosight.hggp.hg.sc.domain.HGSC005A">
SELECT
id as "id",
mat_id as "matId", <!-- 物料清单ID -->
......
......@@ -615,6 +615,11 @@ public class HGSCTools {
}
}
/**
*
* @author:songx
* @date:2024/9/4,22:02
*/
public static class THGSC005A{
public static HGSC005A getById(Long id){
......@@ -640,6 +645,22 @@ public class HGSCTools {
return CollectionUtils.isEmpty(results) ? null : results;
}
/**
* 根据工序查询
*
* @param planCode
* @param processName
* @return
*/
public static List<HGSC005A> queryByPlanCode(String planCode, String processName) {
AssertUtils.isEmpty(planCode, "计划编码不能为空!");
Map paramMap = new HashMap();
paramMap.put(HGSC005A.FIELD_plan_code, planCode);
paramMap.put(HGSC005A.FIELD_process_name, processName);
List<HGSC005A> results = DaoBase.getInstance().query(HGSC005A.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results;
}
public static List<HGSC005A> queryByMatId(Long matId){
AssertUtils.isTrue(Objects.isNull(matId)||matId<=0, "物料清单ID不能为空!");
Map paramMap = new HashMap();
......@@ -1039,10 +1060,11 @@ public class HGSCTools {
* 排产
*
* @param planCode
* @param processName 工序
* @return
*/
public static int schedule(String planCode) {
List<HGSC005A> hgsc005AList = queryByPlanCode(planCode);
public static int schedule(String planCode, String processName) {
List<HGSC005A> hgsc005AList = queryByPlanCode(planCode, processName);
// hgsc005AList.sort(Comparator.comparing(HGSC005A::getProductType).thenComparing(HGSC005A::getProcessOrder,Comparator.reverseOrder()));
//通过工序编码查询工序设置
List<String> processCodes = hgsc005AList.stream().map(HGSC005A::getProcessCode)
......@@ -1080,9 +1102,11 @@ public class HGSCTools {
}
}
for (HGSC005A planInfo : partList) {
remainder = calculateWordHour(planInfo,hgsj001List,hgpz005List,hgpz005AList,minDate,remainder);
minDate = DateUtil.toDate(planInfo.getPlanStartDate(),DateUtil.DATE10_PATTERN).compareTo(DateUtil.toDate(minDate,DateUtil.DATE10_PATTERN)) <=0?planInfo.getPlanStartDate():minDate;
DaoUtils.update(HGSC005A.UPDATE,planInfo);
remainder = calculateWordHour(planInfo, hgsj001List, hgpz005List, hgpz005AList, minDate, remainder);
minDate = DateUtil.toDate(planInfo.getPlanStartDate(), DateUtil.DATE10_PATTERN)
.compareTo(DateUtil.toDate(minDate, DateUtil.DATE10_PATTERN)) <= 0 ? planInfo.getPlanStartDate()
: minDate;
DaoUtils.update(HGSC005A.UPDATE, planInfo);
}
return hgsc005AList.size();
}
......
......@@ -18,7 +18,8 @@ $(function () {
$("#BNT_SCHEDULE").on("click", schedule);
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'save'||e.eiInfo.extAttr.methodName == 'delete' ){
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete'
|| e.eiInfo.extAttr.methodName == 'update') {
query();
}
}
......@@ -41,28 +42,9 @@ $(window).load(function () {
* 排产
*/
function schedule() {
var planCode = $("#inqu_status-0-planCode").val();
IPLAT.confirm({
title: '提交',
message: '自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产?',
okFn: function () {
var inInfo = new EiInfo();
inInfo.set("inqu_status-0-planCode", planCode);
EiCommunicator.send("HGSC005A", "schedule", inInfo, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
$("#inqu_status-0-isSchedule").val('1');
NotificationUtil(ei);
resultGrid.dataSource.query();
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
JSUtils.confirm("自动排产将覆盖原排产数据,请谨慎操作,确认对当前数据进行排产? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGSC005A", "schedule", true);
}
});
}
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