Commit 7a83ca05 by wuwenlong

Merge remote-tracking branch 'origin/dev' into dev

parents 35553a4b 75e83339
...@@ -7,6 +7,7 @@ import com.baosight.hggp.common.ProductTypeEnum; ...@@ -7,6 +7,7 @@ import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.sb.domain.HGSB002;
import com.baosight.hggp.hg.sc.domain.*; import com.baosight.hggp.hg.sc.domain.*;
import com.baosight.hggp.hg.sc.tools.HGSCTools; import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
...@@ -85,6 +86,7 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -85,6 +86,7 @@ public class ServiceHGSC004A extends ServiceBase {
hgsc005a.setProductType(ProductTypeEnum.PART.getCode()); hgsc005a.setProductType(ProductTypeEnum.PART.getCode());
} }
HGSCTools.THGSC005A.delete(hgsc005a); HGSCTools.THGSC005A.delete(hgsc005a);
HGSCTools.THGSC004B.save(hgsc004A,null);
} }
}else{ }else{
DaoUtils.update(HGSC004A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}}); DaoUtils.update(HGSC004A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
...@@ -131,25 +133,32 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -131,25 +133,32 @@ public class ServiceHGSC004A extends ServiceBase {
this.checkSaveData(hgsc004a,hgsc003); this.checkSaveData(hgsc004a,hgsc003);
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){ if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()!=0){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.TH);
if(hgsc004a.getLv().intValue() == 3){ if(hgsc004a.getLv().intValue() == 3){
hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString()); hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString());
}else{ }else{
hgsc004a.setProductType(ProductTypeEnum.PART.getCode().toString()); hgsc004a.setProductType(ProductTypeEnum.PART.getCode().toString());
} }
//主表全部提交时需要有改变状态
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.TH);
HGSC004A oldHGSC004A = (HGSC004A) super.dao.get(HGSC004A.QUERY,HGSC004A.FIELD_id,hgsc004a.getId());
HGSCTools.THGSC004B.save(oldHGSC004A,hgsc004a);
} }
DaoUtils.update(HGSC004A.UPDATE, hgsc004a); DaoUtils.update(HGSC004A.UPDATE, hgsc004a);
}else { }else {
hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ); hgsc004a.setProductStatus(HGConstant.ProductStatus.WTJ);
Map<String,Object> mapA = new HashMap<>();
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
if(hgsc004a.getLv().intValue() == 3){ if(hgsc004a.getLv().intValue() == 3){
hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString()); hgsc004a.setProductType(ProductTypeEnum.STRUCT.getCode().toString());
}else{ }else{
hgsc004a.setProductType(ProductTypeEnum.PART.getCode().toString()); hgsc004a.setProductType(ProductTypeEnum.PART.getCode().toString());
} }
//主表全部提交时需要有改变状态
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.ZJ);
Long maxId = (Long) super.dao.get(HGSC004A.MAX_ID,null,null);
hgsc004a.setId(maxId+1);
HGSCTools.THGSC004B.save(null,hgsc004a);
} }
DaoUtils.insert(HGSC004A.INSERT, hgsc004a); DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
...@@ -231,13 +240,14 @@ public class ServiceHGSC004A extends ServiceBase { ...@@ -231,13 +240,14 @@ public class ServiceHGSC004A extends ServiceBase {
try { try {
HGSC004A hgsc004a = new HGSC004A(); HGSC004A hgsc004a = new HGSC004A();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock); EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
HGSC004 hgsc004 = new HGSC004(); String materialId = eiBlock.getCellStr(ACConstants.ROW_CODE_0, HGSC004A.FIELD_material_id);
HGSC004 hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY_BY_ID,HGSC004.FIELD_id,materialId);
//校验计划父单据是否提交,提交了不让新增
HGSCTools.THGSC004A.checkFatherSubmitStatus(hgsc004.getId());
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
hgsc004a.fromMap(map); hgsc004a.fromMap(map);
if(Objects.isNull(hgsc004.getId()) || hgsc004.getId() == 0){
hgsc004 = (HGSC004) super.dao.get(HGSC004.QUERY_BY_ID,HGSC004.FIELD_id,hgsc004a.getMaterialId());
}
if(Objects.nonNull(hgsc004)){ if(Objects.nonNull(hgsc004)){
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){ if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
//子表 //子表
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.hg.sc.domain.HGSC004B;
import com.baosight.hggp.util.*;
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;
/**
* @Author jhs
* @Date 2024/5/14 14:46
*/
public class ServiceHGSC004E extends ServiceBase {
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC004B.QUERY, new HGSC004B());
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
public EiInfo query(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, HGSC004B.QUERY, new HGSC004B());
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
}
package com.baosight.hggp.hg.sc.tools; package com.baosight.hggp.hg.sc.tools;
import cn.hutool.core.bean.BeanUtil;
import com.baosight.hggp.common.AssignStatusEnum; import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.ComputeTypeEnum; import com.baosight.hggp.common.ComputeTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum; import com.baosight.hggp.common.ProductTypeEnum;
...@@ -95,6 +96,28 @@ public class HGSCTools { ...@@ -95,6 +96,28 @@ public class HGSCTools {
} }
} }
} }
public static class THGSC004A{
public static void checkFatherSubmitStatus(Long matId) {
HGSC005 hgsc005 = THGSC005.queryByMatId(matId);
AssertUtils.isTrue(hgsc005.getCommitStatus().compareTo(CommonConstant.YesNo.NO_0)==1, "生产计划已提交,不能操作!");
}
}
public static class THGSC004B{
public static void save(HGSC004A oldHGSC004A,HGSC004A newHGSC004A) {
HGSC004B hgsc004B = new HGSC004B();
if(Objects.nonNull(oldHGSC004A)){
//变更删除存在历史信息,存历史信息
BeanUtil.copyProperties(oldHGSC004A,hgsc004B,"id");
hgsc004B.setMaterialDetailId(oldHGSC004A.getId());
}else{
//新增的存新录入的信息
BeanUtil.copyProperties(newHGSC004A,hgsc004B,"id");
hgsc004B.setMaterialDetailId(newHGSC004A.getId());
}
AssertUtils.isTrue(Objects.isNull(hgsc004B) || hgsc004B.getMaterialDetailId().intValue() == 0, "生产计划已提交,不能操作!");
DaoUtils.insert(HGSC004B.INSERT,hgsc004B);
}
}
public static class THGSC005{ public static class THGSC005{
public static List<HGSC005> buildFinishRate(List<HGSC005> hgsc005List){ public static List<HGSC005> buildFinishRate(List<HGSC005> hgsc005List){
...@@ -191,7 +214,6 @@ public class HGSCTools { ...@@ -191,7 +214,6 @@ public class HGSCTools {
} }
private static List<HGSC005A> generatorNewPlanDetail(HGSC005A hgsc005a){ private static List<HGSC005A> generatorNewPlanDetail(HGSC005A hgsc005a){
//通过存货档案编码查询存货档案工序 //通过存货档案编码查询存货档案工序
List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCode(hgsc005a.getProductCode()); List<HGPZ005A> hgpz005AList = HGPZTools.HgPz005A.queryByInventCode(hgsc005a.getProductCode());
...@@ -226,7 +248,6 @@ public class HGSCTools { ...@@ -226,7 +248,6 @@ public class HGSCTools {
public static HGSC005A save(HGSC005A hgsc005a){ public static HGSC005A save(HGSC005A hgsc005a){
checkUpdateData(hgsc005a); checkUpdateData(hgsc005a);
checkFatherSubmitStatus(hgsc005a);
constructObj(hgsc005a); constructObj(hgsc005a);
List<HGSC005A> hgsc005AList = generatorNewPlanDetail(hgsc005a); List<HGSC005A> hgsc005AList = generatorNewPlanDetail(hgsc005a);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a); Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
...@@ -289,7 +310,6 @@ public class HGSCTools { ...@@ -289,7 +310,6 @@ public class HGSCTools {
public static void delete(HGSC005A hgsc005a){ public static void delete(HGSC005A hgsc005a){
checkUpdateData(hgsc005a); checkUpdateData(hgsc005a);
checkFatherSubmitStatus(hgsc005a);
Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a); Map<Long,Optional<HGSC005A>> oldObjMap = queryOldPlanDetail(hgsc005a);
oldObjMap.forEach((k,v)->{ oldObjMap.forEach((k,v)->{
HGSC005A oldObj = v.get(); HGSC005A oldObj = v.get();
...@@ -303,11 +323,6 @@ public class HGSCTools { ...@@ -303,11 +323,6 @@ public class HGSCTools {
}); });
} }
private static void checkFatherSubmitStatus(HGSC005A hgsc005a) {
HGSC005 hgsc005 = THGSC005.queryByMatId(hgsc005a.getMatId());
AssertUtils.isTrue(hgsc005.getCommitStatus().compareTo(CommonConstant.YesNo.NO_0)==1, "生产计划已提交,不能操作!");
}
/** /**
* 校验修改的数据 * 校验修改的数据
* *
......
...@@ -98,10 +98,13 @@ $(function () { ...@@ -98,10 +98,13 @@ $(function () {
title: "操作", title: "操作",
template: function (item) { template: function (item) {
let status = item.productStatus; let status = item.productStatus;
let changeType = item.changeType;
let template = ''; let template = '';
if (item.id){ if (item.id){
if(changeType != 0){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id +')" >变更详情</a>'; + 'onclick="showDetail(' + item.id +')" >变更详情</a>';
}
if (status == 0) { if (status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateProductStatus(' + item.id + ',1)" >提交</a>'; + 'onclick="updateProductStatus(' + item.id + ',1)" >提交</a>';
...@@ -521,6 +524,18 @@ let dynamicColumnName = function () { ...@@ -521,6 +524,18 @@ let dynamicColumnName = function () {
} }
} }
/**
* 显示详情
*/
function showDetail(id) {
JSColorbox.open({
href: "HGSC004E?methodName=initLoad&inqu_status-0-materialDetailId=" + id,
title: "<div style='text-align: center;'>变更详情记录</div>",
width: "90%",
height: "90%",
});
}
function updateProductStatus(id,status) { function updateProductStatus(id,status) {
let inEiInfo = new EiInfo(); let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id); inEiInfo.set("result-0-id", id);
......
$(function () {
IPLATUI.EFGrid = {
"result": {
}
};
$("#ef_form_head").hide();
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 初始化查询
query();
});
/**
* 查询
*/
var query = function (e) {
resultGrid.dataSource.page(1);
}
<!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="result" title="变更详情信息">
<EF:EFGrid blockId="result" autoDraw="override" checkMode="row" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="lv" cname="层级" hidden="true"/>
<EF:EFColumn enable="false" ename="parentProdCode" hidden="true" cname="上级产品编号"/>
<EF:EFColumn enable="false" ename="parentProdName" hidden="true" cname="上级产品名称"/>
<EF:EFColumn enable="false" ename="productId" hidden="true" cname="产品id"/>
<EF:EFColumn enable="false" ename="productType" hidden="true" cname="产品类型"/>
<EF:EFColumn enable="false" ename="inventType" hidden="true" cname="库存类型"/>
<EF:EFColumn ename="operator" cname="操作" width="140" enable="false" readonly="false"/>
<EF:EFComboColumn cname="变更类型" ename="changeType" width="90" align="center" enable="false" required="false">
<EF:EFCodeOption codeName="hggp.sc.changeType" />
</EF:EFComboColumn>
<EF:EFColumn ename="productCode" required="true" cname="产品编号" enable="false"/>
<EF:EFColumn ename="productName" cname="产品名称" width="120" align="center" enable="false"/>
<EF:EFColumn ename="quantity" required="true" cname="数量" enable="false" enable="false"/>
<EF:EFColumn ename="singleWeight" required="true" format="{0:N3}" cname="单重(kg)" enable="false"/>
<EF:EFColumn enable="true" required="true" format="{0:N3}" ename="totalWeight" cname="总重(kg)" enable="false"/>
<EF:EFComboColumn cname="提交状态" ename="productStatus" width="90" align="center" required="false" enable="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" />
</EF:EFComboColumn>
</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