Commit f21a06cb by liuyang

2024-10-18

1.生产下料查询数据默认为下料组
2.物料清单保存刷新左侧树形数据
3.生产计划和生产计划详情计划完成完成日期默认为交货日期
parent df46e80f
......@@ -820,9 +820,10 @@ public class HPPZTools {
hpsc002.setProjCode(hpsc001.getProjCode());
hpsc002.setProjName(hpsc001.getProjName());
hpsc002.setParentPrdtName(hpsc001.getProjName());
hpsc002.setDeliveryDate(hpsc001.getDeliveryDate());
hpsc002.setStatus(CommonConstant.YesNo.NO_0);
hpsc002.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002);
DaoBase.getInstance().insert(HPSC002.INSERT, hpsc002);
HPSC002 byProjCode;
if (prdtId_new!=null)
byProjCode = HPSCTools.HpSc002.getByTree2(hpsc002.getProjCode(), prdtId_new.toString());
......@@ -838,10 +839,11 @@ public class HPPZTools {
hpsc002_lv.setCreatedName(UserSession.getUserId());
hpsc002_lv.setProjCode(hpsc001.getProjCode());
hpsc002_lv.setProjName(hpsc001.getProjName());
hpsc002_lv.setDeliveryDate(hpsc001.getDeliveryDate());
hpsc002_lv.setCreatedTime(sdf.format(new Date()));
hpsc002_lv.setStatus(CommonConstant.YesNo.NO_0);
hpsc002_lv.setDelStatus(CommonConstant.YesNo.NO_0);
DaoBase.getInstance().insert("HPSC002.insert", hpsc002_lv);
DaoBase.getInstance().insert(HPSC002.INSERT, hpsc002_lv);
}
}
}
......
......@@ -135,11 +135,15 @@ public class ServiceHPSC002 extends ServiceBase {
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> projectIds = resultRows.stream().map(row -> row.get("projCode").toString()).collect(Collectors.toList());
List<HPSC001> hpsc001s = HPSCTools.HpSc001.queryByCode(projectIds);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPSC002 hpsc002 = new HPSC002();
hpsc002.fromMap(resultRows.get(i));
if (hpsc002.getId() == null || hpsc002.getId() == 0) {
List<HPSC001> hpsc001List = hpsc001s.stream().filter(hpsc001 -> hpsc001.getProjCode().equals(hpsc002.getProjCode())).collect(Collectors.toList());
hpsc002.setDeliveryDate(hpsc001List.get(0).getDeliveryDate());
this.add(hpsc002);
} else {
this.modify(hpsc002);
......@@ -163,16 +167,18 @@ public class ServiceHPSC002 extends ServiceBase {
public EiInfo saveDetail(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
List<String> projectIds = resultRows.stream().map(row -> row.get("projCode").toString()).collect(Collectors.toList());
List<HPSC001> hpsc001s = HPSCTools.HpSc001.queryByCode(projectIds);
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
for (Map resultRow : resultRows) {
HPSC002 hpsc002 = new HPSC002();
hpsc002.fromMap(resultRows.get(i));
hpsc002.setDeliveryDate(DateUtils.formatShort(hpsc002.getDeliveryDate()));
hpsc002.fromMap(resultRow);
List<HPSC001> hpsc001List = hpsc001s.stream().filter(hpsc001 -> hpsc001.getProjCode().equals(hpsc002.getProjCode())).collect(Collectors.toList());
if (hpsc002.getId() == null || hpsc002.getId() == 0) {
hpsc002.setDeliveryDate(DateUtils.formatShort(hpsc002.getDeliveryDate()));
inInfo=this.add(hpsc002);
hpsc002.setDeliveryDate(hpsc001List.get(0).getDeliveryDate());
inInfo = this.add(hpsc002);
} else {
inInfo=this.modify(hpsc002);
inInfo = this.modify(hpsc002);
}
}
/* inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......@@ -212,7 +218,7 @@ public class ServiceHPSC002 extends ServiceBase {
Integer lv = (Integer) this.dao.get("HPSC002.queryLv","id",hpsc002.getParentId());
hpsc002.setLv(lv.intValue()+1);
}
DaoUtils.insert("HPSC002.insert", hpsc002.toMap());
DaoUtils.insert(HPSC002.INSERT, hpsc002.toMap());
//更新零件后,更新部件重量
if(hpsc002.getPrdtType()==3){
......@@ -346,31 +352,34 @@ public class ServiceHPSC002 extends ServiceBase {
public EiInfo insert(EiInfo inInfo) {
try {
HPSC002 hppz002 = new HPSC002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> projectIds = resultRows.stream().map(row -> row.get("projCode").toString()).collect(Collectors.toList());
List<HPSC001> hpsc001s = HPSCTools.HpSc001.queryByCode(projectIds);
for (Map resultRow : resultRows) {
hppz002.fromMap(resultRow);
hppz002.setLeaf("1");
List<HPSC001> hpsc001List = hpsc001s.stream().filter(hpsc001 -> hpsc001.getProjCode().equals(resultRow.get("projCode"))).collect(Collectors.toList());
hppz002.setDeliveryDate(hpsc001List.get(0).getDeliveryDate());
// 计算总重
BigDecimal num = hppz002.getNum();
BigDecimal unitWt = hppz002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()/1000));
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue() / 1000));
hppz002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
hppz002.setTotalWt(totalWt);
// if (StringUtils.isNotEmpty(hppz002.getPrdtCode()) && !hppz002.getParentId().equals("root")) {
// hppz002.setPrdtName(HPPZTools.getPz004ByCode(hppz002.getPrdtCode()).getInventName());
// }
hppz002.setSpec(HPPZTools.HpPz006.jointSpec(hppz002.getLength(),hppz002.getWidth(),hppz002.getThick()));
if(hppz002.getParentId().equals("root")){
hppz002.setSpec(HPPZTools.HpPz006.jointSpec(hppz002.getLength(), hppz002.getWidth(), hppz002.getThick()));
if (hppz002.getParentId().equals("root")) {
hppz002.setLv(new Integer(1));
}else{
hppz002.setPrdtCode(HPPZTools.HpPz004.checkAndSave(hppz002.getPrdtType(),hppz002.getPrdtName()));
Integer lv = (Integer) this.dao.get("HPSC002.queryLv","id",hppz002.getParentId());
hppz002.setLv(lv.intValue()+1);
} else {
hppz002.setPrdtCode(HPPZTools.HpPz004.checkAndSave(hppz002.getPrdtType(), hppz002.getPrdtName()));
Integer lv = (Integer) this.dao.get("HPSC002.queryLv", "id", hppz002.getParentId());
hppz002.setLv(lv.intValue() + 1);
}
DaoUtils.insert("HPSC002.insert", hppz002.toMap());
DaoUtils.insert(HPSC002.INSERT, hppz002.toMap());
if (!hppz002.getParentId().equals("root")) {
this.checkTreeNodeLeaf(hppz002.getParentId());
......@@ -864,8 +873,8 @@ public class ServiceHPSC002 extends ServiceBase {
newSc004.setParentId(planNo);
newSc004.setMatId(dbSc002Child.getId());
newSc004.setFilePath1(dbSc002Child.getId().toString());
newSc004.setPlanCompletionDate(dbSc002Child.getDeliveryDate());
newSc004.setPlanCommentDate(dbSc002Child.getDeliveryDate());
newSc004.setPlanCompletionDate(dbSc002.getDeliveryDate());
newSc004.setPlanCommentDate(dbSc002.getDeliveryDate());
newSc004.setDelStatus(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPSC004.INSERT, newSc004);
}
......
......@@ -5,6 +5,7 @@ import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.HPConstants;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.ds.domain.HPDS002;
......@@ -105,6 +106,11 @@ public class ServiceHPSC0061 extends ServiceBase {
public EiInfo queryDetail(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
List<Map> list = HPXSTools.XsOrg.queryParent(null, OrgTypeEnum.CUT_GROUP.getCode());
if (!CollectionUtils.isEmpty(list)){
List<String> orgIds = list.stream().map(m -> m.get("orgId").toString()).collect(Collectors.toList());
queryMap.put("groupCodes", orgIds);
}
queryMap.put("prodOrderNo", inInfo.getString("prodOrderNo"));
List<HPSC0061> dbSc0061s = dao.query("HPSC0061.queryDetail", queryMap);
inInfo.addBlock(CommonConstant.Field.DETAIL).setRows(dbSc0061s);
......
......@@ -169,13 +169,16 @@ public class ServiceHPSC102 extends ServiceEPBase {
public EiInfo saveDetail(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(CommonConstant.Field.DETAIL).getRows();
List<String> projectIds = resultRows.stream().map(row -> row.get("projCode").toString()).collect(Collectors.toList());
List<HPSC001> hpsc001s = HPSCTools.HpSc001.queryByCode(projectIds);
// 写入数据
for (Map resultRow : resultRows) {
HPSC002 hpsc002 = new HPSC002();
hpsc002.fromMap(resultRow);
hpsc002.setDeliveryDate(DateUtils.formatShort(hpsc002.getDeliveryDate()));
List<HPSC001> hpsc001List = hpsc001s.stream().filter(hpsc001 -> hpsc001.getProjCode().equals(resultRow.get("projCode"))).collect(Collectors.toList());
hpsc002.setDeliveryDate(hpsc001List.get(0).getDeliveryDate());
if (hpsc002.getId() == null || hpsc002.getId() == 0) {
hpsc002.setDeliveryDate(DateUtils.formatShort(hpsc002.getDeliveryDate()));
hpsc002.setDeliveryDate(hpsc001List.get(0).getDeliveryDate());
inInfo = this.add(hpsc002);
} else {
inInfo = this.modify(hpsc002);
......@@ -344,29 +347,32 @@ public class ServiceHPSC102 extends ServiceEPBase {
public EiInfo insert(EiInfo inInfo) {
try {
HPSC002 hppz002 = new HPSC002();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hppz002.fromMap(map);
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<String> projectIds = resultRows.stream().map(row -> row.get("projCode").toString()).collect(Collectors.toList());
List<HPSC001> hpsc001s = HPSCTools.HpSc001.queryByCode(projectIds);
for (Map resultRow : resultRows) {
hppz002.fromMap(resultRow);
hppz002.setLeaf("1");
List<HPSC001> hpsc001List = hpsc001s.stream().filter(hpsc001 -> hpsc001.getProjCode().equals(resultRow.get("projCode"))).collect(Collectors.toList());
hppz002.setDeliveryDate(hpsc001List.get(0).getDeliveryDate());
// 计算总重
BigDecimal num = hppz002.getNum();
BigDecimal unitWt = hppz002.getUnitWt();
DecimalFormat decimalFormat = new DecimalFormat("#.000");
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue()/1000));
BigDecimal totalWt = new BigDecimal(decimalFormat.format(num.multiply(unitWt).floatValue() / 1000));
hppz002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
hppz002.setTotalWt(totalWt);
// if (StringUtils.isNotEmpty(hppz002.getPrdtCode()) && !hppz002.getParentId().equals("root")) {
// hppz002.setPrdtName(HPPZTools.getPz004ByCode(hppz002.getPrdtCode()).getInventName());
// }
hppz002.setSpec(HPPZTools.HpPz006.jointSpec(hppz002.getLength(),hppz002.getWidth(),hppz002.getThick()));
if(hppz002.getParentId().equals("root")){
hppz002.setSpec(HPPZTools.HpPz006.jointSpec(hppz002.getLength(), hppz002.getWidth(), hppz002.getThick()));
if (hppz002.getParentId().equals("root")) {
hppz002.setLv(new Integer(1));
}else{
hppz002.setPrdtCode(HPPZTools.HpPz004.checkAndSave(hppz002.getPrdtType(),hppz002.getPrdtName()));
Integer lv = (Integer) this.dao.get("HPSC002.queryLv","id",hppz002.getParentId());
hppz002.setLv(lv.intValue()+1);
} else {
hppz002.setPrdtCode(HPPZTools.HpPz004.checkAndSave(hppz002.getPrdtType(), hppz002.getPrdtName()));
Integer lv = (Integer) this.dao.get("HPSC002.queryLv", "id", hppz002.getParentId());
hppz002.setLv(lv.intValue() + 1);
}
DaoUtils.insert(HPSC002.INSERT, hppz002.toMap());
......@@ -883,8 +889,8 @@ public class ServiceHPSC102 extends ServiceEPBase {
newSc004.setParentId(planNo);
newSc004.setMatId(dbSc002Child.getId());
newSc004.setFilePath1(dbSc002Child.getId().toString());
newSc004.setPlanCompletionDate(dbSc002Child.getDeliveryDate());
newSc004.setPlanCommentDate(dbSc002Child.getDeliveryDate());
newSc004.setPlanCompletionDate(hpsc002.getDeliveryDate());
newSc004.setPlanCommentDate(hpsc002.getDeliveryDate());
newSc004.setFactoryCode(org.getOrgId());
newSc004.setProdOrderNo(prodOrderNo);
newSc004.setDelStatus(CommonConstant.YesNo.NO_0);
......
......@@ -91,8 +91,11 @@
B.GROUP_NAME as "groupName",
IFNULL(B.COMPLETE_STATUS, 0) as "completeStatus"
FROM ${hpjxSchema}.T_HPSC0061A A
LEFT JOIN ${hpjxSchema}.T_HPSC0061 B
ON A.INVENT_CODE = B.INVENT_CODE AND B.PROD_ORDER_NO = #prodOrderNo#
LEFT JOIN ${hpjxSchema}.T_HPSC0061 B ON A.INVENT_CODE = B.INVENT_CODE
WHERE B.PROD_ORDER_NO = #prodOrderNo#
<isNotEmpty prepend=" AND " property="groupCodes">
B.GROUP_CODE IN <iterate close=")" open="(" conjunction="," property="groupCodes">#groupCodes[]#</iterate>
</isNotEmpty>
ORDER BY A.INVENT_CODE ASC
</select>
......@@ -102,6 +105,10 @@
LEFT JOIN ${hpjxSchema}.T_HPSC0061 B
ON A.INVENT_CODE = B.INVENT_CODE
WHERE B.PROD_ORDER_NO = #prodOrderNo#
<isNotEmpty prepend=" AND " property="groupCode">
B.GROUP_CODE = #groupCode#
</isNotEmpty>
</select>
<insert id="insert">
......
......@@ -105,7 +105,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
REGISTER_DATE desc
</isEmpty>
</dynamic>
......@@ -141,7 +141,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
REGISTER_DATE desc
</isEmpty>
</dynamic>
......@@ -177,7 +177,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
REGISTER_DATE desc
</isEmpty>
</dynamic>
......@@ -403,7 +403,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.FACTORY_CODE,B.SORT_INDEX ASC
A.FACTORY_CODE
</isEmpty>
</dynamic>
......@@ -443,14 +443,6 @@
GROUP_TYPE = #groupType#
</isNotEmpty>
GROUP BY USER_ID,USER_NAME,FACTORY_CODE,FACTORY_NAME,GROUP_CODE,GROUP_NAME
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
CREATED_TIME desc
</isEmpty>
</dynamic>
</select>
......@@ -487,7 +479,7 @@
$orderBy$
</isNotEmpty>
<isEmpty property="orderBy">
A.FACTORY_CODE,B.SORT_INDEX ASC
A.FACTORY_CODE
</isEmpty>
</dynamic>
......
......@@ -271,16 +271,19 @@ public class HPXSTools {
* @return
*/
public static List<Map> queryParent(String orgId,String orgType) {
AssertUtils.isNull(orgId, "组织ID不能为空");
//AssertUtils.isNull(orgId, "组织ID不能为空");
AssertUtils.isNull(orgType, "组织类型不能为空");
Map queryMap = new HashMap();
if (StringUtils.isNotNull(orgId)){
queryMap.put("parentOrgId", orgId);
}
queryMap.put("orgType", orgType);
List<Map> results = DaoBase.getInstance().query("HPXSOrg.queryGroupComboBox", queryMap);
AssertUtils.isEmpty(results, String.format("组织[%s]不存在父级信息", orgId));
return results;
//AssertUtils.isEmpty(results, String.format("组织[%s]不存在父级信息", orgId));
return CollectionUtils.isEmpty(results)? new ArrayList<>():results;
}
/**
......
......@@ -744,6 +744,22 @@ function saveFunc() {
JSUtils.submitGridsData("result", "HPSC002", "save",
true, function (res) {
if (res.status > -1) {
const tree = $("#materialTree").data("kendoTreeView");
var selectedNode = tree.select();
tree.append({ // append()selecttedNode
nodeId: rows[0].id,
label: rows[0].id,
text: rows[0].prdtName,
pId : rows[0].parentId,
prdtCode: rows[0].prdtCode,
prdtName: rows[0].prdtName,
projCode: rows[0].projCode,
projName: rows[0].projName,
deliveryDate: rows[0].deliveryDate,
lv: rows[0].lv
}, selectedNode);
tree.reload(rows[0].parentId)
expandTreeNode(tree, rows[0].parentId);
refreshTree();
}
}
......@@ -758,15 +774,32 @@ function saveFunc() {
*/
let refreshTree = function () {
setTimeout(() => {
const selectTreeNode = (tree, treeOrgId) => {
if (!tree || treeOrgId == null) {
return
}
setTimeout(() => {
let barDataItem = tree.dataSource.get(treeOrgId);
if (barDataItem) {
let barElement = tree.findByUid(barDataItem.uid);
// 刷新完成后选中对应的树节点
tree.select(barElement);
setTreeNodeValue(barDataItem)
} else {
selectTreeNode(tree, treeOrgId)
}
}, 100)
}
// 刷新树节点
const tree = $("#materialTree").data("kendoTreeView");
// 选中的节点
const treeId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
tree.reload(treeId)
// 展开成功后选中对应的树节点
expandTreeNode(tree, treeId);
const treeOrgId = IPLATUI.EFTree.materialTree.selectTreeNode.nodeId;
tree.reload(treeOrgId)
expandTreeNode(tree, treeOrgId)
// tree.expandPath(treeOrgId)
// 展开成功后选中对应的树节点
selectTreeNode(tree, treeId);
selectTreeNode(tree, treeOrgId);
}, 500);
}
......
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