Commit 4eada0c5 by 宋祥

1.fixBug:生产任务查询无数据问题修复

parent 482118fc
......@@ -48,6 +48,10 @@ public class CommonConstant {
// DETAIL
public static final String DETAIL = "detail";
// ID
public static final String ID = "id";
// 生产订单号
public static final String PROD_ORDER_NO = "prodOrderNo";
}
}
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.sc.domain.HPSC004;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.DateUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.StringUtil;
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.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 org.apache.commons.collections.MapUtils;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author:songx
......@@ -39,9 +28,11 @@ public class ServiceHPSC005 extends ServiceBase {
* @return
*/
public EiInfo initLoad(EiInfo inInfo) {
HPSC005 HPSC005 = new HPSC005();
EiInfo outInfo = super.initLoad(inInfo, HPSC005);
outInfo.addBlock(EiConstant.resultBlock).addBlockMeta(HPSC005.eiMetadata);
try {
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC005().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
......@@ -65,119 +56,6 @@ public class ServiceHPSC005 extends ServiceBase {
}
/**
* 新增操作.
*/
@Override
public EiInfo insert(EiInfo inInfo) {
try {
HPSC005 HPSC005 = new HPSC005();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPSC005.fromMap(map);
DaoUtils.insert("HPSC005.insert", HPSC005.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("新增成功!");
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("新增失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("新增失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
/**
* 修改操作.
*/
public EiInfo update(EiInfo inInfo) {
try {
HPSC005 HPSC005 = new HPSC005();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPSC005.fromMap(map);
DaoUtils.update("HPSC005.update", HPSC005.toMap());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsg("修改成功!");
} catch (PlatException e) {
inInfo.setStatus(EiConstant.STATUS_FAILURE);
inInfo.setMsg("操作失败!原因参见详细错误描述!");
inInfo.setDetailMsg(e.getMessage());
logError("修改失败", e.getMessage());
return inInfo;
}
return query(inInfo);
}
/**
* 删除操作.
*/
public EiInfo delete(EiInfo eiInfo) {
HPSC005 HPSC005 = new HPSC005();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
HPSC005.fromMap(map);
this.dao.delete("HPSC005.delete", HPSC005.toMap());
}
} catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("删除失败,原因参见详细错误描述!");
eiInfo.setDetailMsg(e.getMessage());
logError("删除失败!", e.getMessage());
return eiInfo;
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("删除成功!");
return eiInfo;
}
/**
* 分派
* @param eiInfo
* @return
*/
public EiInfo assign(EiInfo eiInfo) {
try {
String ids = eiInfo.get("ids").toString();
String orgId = eiInfo.get("id").toString();
//先找到分派的组织
HPPZ011 HPPZ011 =(HPPZ011) dao.get("HPPZ011.get","id", 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(2);
HPSC005.setOrgNo(HPPZ011.getGroupCode());
HPSC005.setFactoryCode(HPPZ011.getFactoryCode());
HPSC005.setFactoryName(HPPZ011.getFactoryName());
DaoUtils.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);
}
/**
* 项目下拉框
*
* @param inInfo
......
......@@ -2,9 +2,9 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
......@@ -17,7 +17,6 @@ import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtil;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
......@@ -45,9 +44,9 @@ public class ServiceHPSC005A extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = EiInfoUtils.getFirstRow(inInfo);
String prodOrderNo = MapUtils.getString(queryMap, "prodOrderNo");
String prodOrderNo = MapUtils.getString(queryMap, CommonConstant.Field.PROD_ORDER_NO);
HPSC005 dbSc005 = HPSCTools.HpSc005.get(prodOrderNo);
inInfo.addBlock("detail").addRow(dbSc005);
inInfo.addBlock(CommonConstant.Field.DETAIL).addRow(dbSc005);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC005A().eiMetadata);
} catch (Exception e) {
......@@ -80,8 +79,8 @@ public class ServiceHPSC005A extends ServiceBase {
*/
public EiInfo save(EiInfo inInfo) {
try {
Map detailMap = EiInfoUtils.getFirstRow(inInfo, "detail");
String prodOrderNo = MapUtils.getString(detailMap, "prodOrderNo");
Map detailMap = EiInfoUtils.getFirstRow(inInfo, CommonConstant.Field.DETAIL);
String prodOrderNo = MapUtils.getString(detailMap, CommonConstant.Field.PROD_ORDER_NO);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 生产任务号
List<String> prodTaskNos = ObjectUtils.listKey(resultRows, "prodTaskNo");
......@@ -167,8 +166,8 @@ public class ServiceHPSC005A extends ServiceBase {
*/
public EiInfo delete(EiInfo inInfo) {
try {
Map detailMap = EiInfoUtils.getFirstRow(inInfo, "detail");
String prodOrderNo = MapUtils.getString(detailMap, "prodOrderNo");
Map detailMap = EiInfoUtils.getFirstRow(inInfo, CommonConstant.Field.DETAIL);
String prodOrderNo = MapUtils.getString(detailMap, CommonConstant.Field.PROD_ORDER_NO);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (Map resultRow : resultRows) {
HPSC005A fSc005a = new HPSC005A();
......@@ -200,7 +199,7 @@ public class ServiceHPSC005A extends ServiceBase {
*/
private EiInfo refreshOrderInfo(EiInfo inInfo, String prodOrderNo) {
HPSC005 dbSc005 = HPSCTools.HpSc005.get(prodOrderNo);
inInfo.addBlock("detail").addRow(dbSc005);
inInfo.addBlock(CommonConstant.Field.DETAIL).addRow(dbSc005);
return inInfo;
}
......@@ -219,16 +218,26 @@ public class ServiceHPSC005A extends ServiceBase {
for (String orderId : orderIds) {
// 校验主订单是否已分派
HPSC005 dbSc005 = HPSCTools.HpSc005.getById(Long.parseLong(orderId));
AssertUtils.isTrue(!ProdOrderStatusEnum.NOT_ASSIGN.getCode().equals(dbSc005.getStatus()),
String.format("生产订单[%s]已分派,不能在进行批量分派,请检查!", dbSc005.getProdOrderNo()));
AssertUtils.isTrue(ProdOrderStatusEnum.ALL_ASSIGN.getCode().equals(dbSc005.getStatus()),
String.format("生产订单[%s]已全部分派,不能在进行批量分派,请检查!", dbSc005.getProdOrderNo()));
// 更新订单主表数量
if (ProdOrderStatusEnum.NOT_ASSIGN.getCode().equals(dbSc005.getStatus())) {
HPSCTools.checkAssignedNum(dbSc005.getProdOrderNo(), dbSc005.getNum());
} else {
HPSCTools.checkAssignedNum2(dbSc005.getProdOrderNo(), dbSc005.getUnassignedNum());
}
HPSCTools.checkAssignedNum(dbSc005.getProdOrderNo(), dbSc005.getNum());
// 写入子表数据
HPSC005A newSc005a = new HPSC005A();
newSc005a.setProdTaskNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.PROD_TASK_NO,
new String[]{dbSc005.getProdOrderNo()}));
newSc005a.setProdOrderNo(dbSc005.getProdOrderNo());
newSc005a.setNum(dbSc005.getNum());
//区分未派单与部分派单
if (ProdOrderStatusEnum.NOT_ASSIGN.getCode().equals(dbSc005.getStatus())) {
newSc005a.setNum(dbSc005.getNum());
} else {
newSc005a.setNum(dbSc005.getUnassignedNum());
}
newSc005a.setTotalWt(newSc005a.getNum().multiply(dbSc005.getUnitWt()));
newSc005a.setOrgNo(dbPz011.getGroupCode());
newSc005a.setOrgName(dbPz011.getGroupName());
......
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005;
import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
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.iplat4j.ed.util.SequenceGenerator;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 生产任务
......
......@@ -112,7 +112,7 @@
SELECT
<include refid="column"/>
FROM HPJX.T_HPSC005 A
INNER JOIN HPJX.T_HPSC005A B ON A.PRODUCTION_ORDER_NO = B.PROD_ORDER_NO
INNER JOIN HPJX.T_HPSC005A B ON A.PROD_ORDER_NO = B.PROD_ORDER_NO
LEFT JOIN ( SELECT
DISTINCT PROD_TASK_NO
FROM HPJX.T_HPZL001 WHERE 1=1 AND DELETE_FLAG = 0 AND STATUS = 0) C ON B.PROD_TASK_NO = C.PROD_TASK_NO
......
......@@ -68,7 +68,7 @@ function tearAssign(prodOrderNo) {
*/
function tearDetails(prodOrderNo) {
JSColorbox.open({
href: "HPSC005C?methodName=initLoad&inqu_status-0-prodOrderNo=" + prodOrderNo",
href: "HPSC005C?methodName=initLoad&inqu_status-0-prodOrderNo=" + prodOrderNo,
title: "<div style='text-align: center;'>生产订单详情</div>",
width: "80%",
height: "90%",
......
......@@ -9,15 +9,14 @@
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput cname="生产订单号" blockId="inqu_status" ename="prodOrderNo" row="0" colWidth="3"/>
<EF:EFInput cname="项目号" blockId="inqu_status" ename="projCode" row="0" colWidth="3"/>
<EF:EFInput cname="项目名称" blockId="inqu_status" ename="projName" row="0" colWidth="3"/>
<EF:EFInput cname="部件名称" blockId="inqu_status" ename="prdtName" row="0" colWidth="3"/>
<EF:EFInput cname="零件名称" blockId="inqu_status" ename="partName" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput cname="零件名称" blockId="inqu_status" ename="partName" row="0" colWidth="3"/>
<EF:EFDatePicker cname="计划完成日期:" blockId="inqu_status" ename="planCompletionDate" row="0" colWidth="3"
<EF:EFDatePicker cname="计划完成日期" blockId="inqu_status" ename="planCompletionDate" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
<EF:EFSelect cname="状态:" optionLabel="全部" blockId="inqu_status" ename="status" row="0" colWidth="3">
<EF:EFSelect cname="状态" optionLabel="全部" blockId="inqu_status" ename="status" row="0" colWidth="3">
<EF:EFOption label="未派工" value="0"/>
<EF:EFOption label="部分派工" value="1"/>
<EF:EFOption label="全部派工" value="2"/>
......@@ -37,18 +36,18 @@
</EF:EFComboColumn>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prdtName" cname="部件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="prdtSpec" cname="部件规格" enable="false" width="120" align="center"/>
<%--<EF:EFColumn ename="prdtSpec" cname="部件规格" enable="false" width="120" align="center"/>--%>
<EF:EFColumn ename="partName" cname="零件名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="partSpec" cname="零件规格" enable="false" width="120" align="center"/>
<EF:EFColumn ename="planCompletionDate" cname="计划完成日期" enable="false" width="120" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="assignedNum" cname="已派工数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="num" cname="计划数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="totalWt" cname="计划重量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="remark" cname="部件备注" enable="false"/>
<EF:EFColumn ename="unassignedNum" cname="剩余数量" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="num" cname="数量" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="totalWt" cname="重量" enable="false" width="120" align="right" format="{0:N3}"/>
<%--<EF:EFColumn ename="remark" cname="部件备注" enable="false"/>--%>
<EF:EFColumn ename="remark1" cname="零件备注" enable="false"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="prodOrderNo" cname="生产订单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
</EF:EFGrid>
......
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