Commit 0cb816e1 by liuyang

2024-08-14 设备管理开发

parent 7db3aa99
package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.common.ProdOrderStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.*;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.domain.HPSC106;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.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.soa.XLocalManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -197,6 +206,55 @@ public class HPKCTools {
}
return results.stream().collect(Collectors.toMap(HPKC003::getProdNo, item -> item));
}
/**
* 添加生产入库
*
* @param hpsc106
* @return
*/
public static void addHpKc003(HPSC106 hpsc106) {
// 订单号
String prodOrderNo = hpsc106.getProdOrderNo();
// 任务号
String prodTaskNo = hpsc106.getProdTaskNo();
// 锁生产计划
HPSCTools.HpSc004.lock(prodOrderNo);
// 锁生产订单
HPSCTools.HpSc005.lock(prodOrderNo);
// 锁生产任务
HPSCTools.HpSc005a.lock(prodTaskNo);
// 查询生产任务信息
Map<String, HPSC005B> dbSc005bMap = HPSCTools.HpSc005b.map(prodTaskNo);
List<Map<String,String>> mapList = DaoBase.getInstance().query("HPPZ007.queryComboBox", new HashMap<String, Object>(){{
put("inventTypes", new String[]{"3"});
}});
AssertUtils.isEmpty(mapList, "仓库不存在");
// 生成入库单
BigDecimal totalWeight = hpsc106.getTotalWeight();
BigDecimal quantity = hpsc106.getQuantity();
HPSC005B fSc005b = BeanUtils.copy(hpsc106, HPSC005B.class);
HPSC005B dbSc005b = dbSc005bMap.get(fSc005b.getProdTaskNo());
HPKC003 newKc003 = BeanUtils.copy(dbSc005b, HPKC003.class);
newKc003.setProdNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC003_PROD_NO));
newKc003.setDocumentDate(DateUtils.shortDate());
newKc003.setWhCode(mapList.get(0).get("whCode"));
newKc003.setWhName(mapList.get(0).get("whName"));
//newKc003.setRemark(MapUtils.getString(row, "remark1"));
newKc003.setAmount(quantity);
newKc003.setWeight(totalWeight);
newKc003.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPKC003.INSERT, newKc003);
// 同步生产计划
HPSCTools.syncPlan(newKc003.getProdOrderNo(), newKc003.getAmount(), newKc003.getWeight());
// 更新生产任务已完成数量
HPSCTools.HpSc005a.updateCompleteNum(fSc005b.getProdTaskNo(), quantity);
// 修改库存
HPKCTools.updateProdStock(newKc003.getWhCode(), newKc003.getProdOrderNo(),
newKc003.getAmount(), newKc003.getWeight(),fSc005b.getFactoryCode());
}
}
/**
......
......@@ -126,7 +126,6 @@
A.DOC_NAME as "docName"
</sql>
<sql id="detailCondition">
<include refid="detailAuthCondition"/>
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
</isNotEmpty>
......@@ -200,88 +199,88 @@
<!--安全记录-->
<sql id="detail1Column">
A.ID as "id", <!-- ID -->
A.COMPANY_CODE as "companyCode", <!-- 公司编码 -->
A.DEP_CODE as "depCode", <!-- 部门编码 -->
A.CREATED_BY as "createdBy", <!-- 创建人 -->
A.CREATED_NAME as "createdName", <!-- 创建人名称 -->
A.CREATED_TIME as "createdTime", <!-- 创建时间 -->
A.UPDATED_BY as "updatedBy", <!-- 修改人 -->
A.UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
A.UPDATED_TIME as "updatedTime", <!-- 修改时间 -->
A.DELETE_FLAG as "deleteFlag", <!-- 是否删除 0-否1-是 -->
A.FACTORY_CODE as "factoryCode", <!-- 工厂代码(公司名称) -->
A.FACTORY_NAME as "factoryName", <!-- 工厂名称 -->
A.GROUP_CODE as "groupCode", <!-- 生产组代码(设备区域) -->
A.GROUP_NAME as "groupName", <!-- 生产组名称 -->
A.RECORD_DATE as "recordDate", <!-- 记录日期 -->
A.RECORD_CODE as "recordCode", <!-- 记录单号 -->
A.DEVICE_TYPE as "deviceType", <!-- 设备类型 -->
A.DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
A.DEVICE_NAME as "deviceName", <!-- 设备名称 -->
A.DEVICE_MODEL as "deviceModel", <!-- 设备型号 -->
A.SECURE_DESC as "secureDesc" <!-- 安全事故描述 -->
ID as "id", <!-- ID -->
COMPANY_CODE as "companyCode", <!-- 公司编码 -->
DEP_CODE as "depCode", <!-- 部门编码 -->
CREATED_BY as "createdBy", <!-- 创建人 -->
CREATED_NAME as "createdName", <!-- 创建人名称 -->
CREATED_TIME as "createdTime", <!-- 创建时间 -->
UPDATED_BY as "updatedBy", <!-- 修改人 -->
UPDATED_NAME as "updatedName", <!-- 修改人名称 -->
UPDATED_TIME as "updatedTime", <!-- 修改时间 -->
DELETE_FLAG as "deleteFlag", <!-- 是否删除 0-否1-是 -->
FACTORY_CODE as "factoryCode", <!-- 工厂代码(公司名称) -->
FACTORY_NAME as "factoryName", <!-- 工厂名称 -->
GROUP_CODE as "groupCode", <!-- 生产组代码(设备区域) -->
GROUP_NAME as "groupName", <!-- 生产组名称 -->
RECORD_DATE as "recordDate", <!-- 记录日期 -->
RECORD_CODE as "recordCode", <!-- 记录单号 -->
DEVICE_TYPE as "deviceType", <!-- 设备类型 -->
DEVICE_CODE as "deviceCode", <!-- 设备编码 -->
DEVICE_NAME as "deviceName", <!-- 设备名称 -->
DEVICE_MODEL as "deviceModel", <!-- 设备型号 -->
SECURE_DESC as "secureDesc" <!-- 安全事故描述 -->
</sql>
<sql id="detail1Condition">
<isNotEmpty prepend=" AND " property="id">
A.ID = #id#
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
A.COMPANY_CODE = #companyCode#
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
A.CREATED_BY = #createdBy#
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
A.CREATED_NAME like CONCAT('%',#createdName#,'%')
CREATED_NAME like CONCAT('%',#createdName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
A.CREATED_TIME = #createdTime#
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
A.UPDATED_BY = #updatedBy#
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
A.UPDATED_NAME = #updatedName#
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
A.UPDATED_TIME = #updatedTime#
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
A.DELETE_FLAG = #deleteFlag#
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
A.FACTORY_CODE = #factoryCode#
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryName">
A.FACTORY_NAME = #factoryName#
FACTORY_NAME = #factoryName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupCode">
A.GROUP_CODE = #groupCode#
<!--<isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="groupName">
A.GROUP_NAME = #groupName#
</isNotEmpty>
GROUP_NAME = #groupName#
</isNotEmpty>-->
<isNotEmpty prepend=" AND " property="recordDate">
A.RECORD_DATE = #recordDate#
RECORD_DATE = #recordDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="recordCode">
A.RECORD_CODE like CONCAT('%',#recordCode#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceType">
A.DEVICE_TYPE = #deviceType#
RECORD_CODE like CONCAT('%',#recordCode#,'%')
</isNotEmpty>
<!--<isNotEmpty prepend=" AND " property="deviceType">
DEVICE_TYPE = #deviceType#
</isNotEmpty>-->
<isNotEmpty prepend=" AND " property="deviceCode">
A.DEVICE_CODE = #deviceCode#
DEVICE_CODE = #deviceCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceName">
A.DEVICE_NAME = #deviceName#
DEVICE_NAME = #deviceName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deviceModel">
A.DEVICE_MODEL = #deviceModel#
DEVICE_MODEL = #deviceModel#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="secureDesc">
A.SECURE_DESC = #secureDesc#
SECURE_DESC = #secureDesc#
</isNotEmpty>
</sql>
......
package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.CompanyTypeEnum;
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.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ003;
import com.baosight.hpjx.hp.pz.domain.HPPZ016;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.util.*;
import com.baosight.hpjx.util.contants.ACConstants;
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.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.*;
/**
* @author LiuYang
* @version 1.0 2024/8/15
* @description 销售管理
*/
public class ServiceHPSC101 extends ServiceEPBase {
/**
* 画面初始化.
*/
@OperationLogAnnotation(operModul = "销售管理",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
inInfo = super.query(inInfo, "HPSC001.query", new HPSC001());
Map map = new HashMap();
map.put("companyCode", UserSessionUtils.getCompanyCode());
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.USER_BLOCK_ID), map,true);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), null);
map.clear();
map.put("itemCode", "ITEM_CODE in ('4')");
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID, DdynamicEnum.CODESET_CODE_BLOCK_ID), map,
false);
} catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
inInfo.setStatus(500);
}
return inInfo;
}
/**
* 查询操作.
*/
@Override
@OperationLogAnnotation(operModul = "销售管理",operType = "查询")
public EiInfo query(EiInfo inInfo) {
try {
inInfo.setCell(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC001.FIELD_DELIVERY_DATE,
DateUtils.formatShort(inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HPSC001.FIELD_DELIVERY_DATE)));
inInfo=super.query(inInfo, "HPSC001.query", new HPSC001());
inInfo.addBlock(HPConstants.BLOCK_DETAIL).addBlockMeta(new HPSC002().eiMetadata);
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
inInfo.setStatus(500);
}
return inInfo;
}
/**
* 新增操作.
*/
@Override
@OperationLogAnnotation(operModul = "销售管理",operType = "新增")
public EiInfo insert(EiInfo inInfo) {
try {
HPSC001 hpsc001 = new HPSC001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
hpsc001.setStatus(CommonConstant.YesNo.NO_0);
hpsc001.setProjCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.PROJ_NUMBER));
DaoUtils.insert("HPSC001.insert",hpsc001);
}
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);
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "企业管理",operType = "插入",operDesc = "保存")
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HPSC001 hpsc001 = new HPSC001();
hpsc001.fromMap(resultRows.get(i));
HPPZ003 fPz003 = new HPPZ003();
if (hpsc001.getPrinc2().trim().isEmpty()) {
/*添加客户档案*/
fPz003.setCustCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPPZ003_CUST_CODE));
fPz003.setCustType(CompanyTypeEnum.GQ.getCode());
fPz003.setCustName(resultRows.get(i).get("princ2Name").toString());
fPz003.setCompanyName(resultRows.get(i).get("princ2Name").toString());
DaoUtils.insert("HPPZ003.insert", fPz003);
HPPZ016 hppz016 = new HPPZ016();
hppz016.setCustCode(fPz003.getCustCode());
hppz016.setCustName(fPz003.getCustName());
hppz016.setPurchaseDate(StringUtil.removeHorizontalLine(DateUtils.date()));
hppz016.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ016.INSERT, hppz016);
hpsc001.setPrinc2(fPz003.getCustCode());
}
if (hpsc001.getId() == null || hpsc001.getId() == 0) {
this.add(hpsc001);
} else {
this.modify(hpsc001);
}
}
inInfo = this.query(inInfo);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.CUSTOMER_RECORD_BLOCK_ID), null);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 新增企业信息
*
* @param hpsc001
* @throws Exception
*/
private void add(HPSC001 hpsc001) throws Exception {
hpsc001.setDeliveryDate(DateUtils.formatShort(hpsc001.getDeliveryDate()));
hpsc001.setProjCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.PROJ_NUMBER));
DaoUtils.insert("HPSC001.insert", hpsc001);
}
/**
* 修改数据
*
* @param hpsc001
*/
private void modify(HPSC001 hpsc001) {
hpsc001.setDeliveryDate(DateUtils.formatShort(hpsc001.getDeliveryDate()));
DaoUtils.update("HPSC001.update", hpsc001);
}
/**
* 修改操作.
*/
@OperationLogAnnotation(operModul = "销售管理",operType = "修改")
public EiInfo update(EiInfo inInfo) {
try {
HPSC001 hpsc001 = new HPSC001();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
hpsc001.setDeliveryDate(DateUtils.formatShort(hpsc001.getDeliveryDate()));
DaoUtils.update("HPSC001.update",hpsc001);
}
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);
}
/**
* 删除操作.
*/
@OperationLogAnnotation(operModul = "销售管理",operType = "删除")
public EiInfo delete(EiInfo eiInfo) {
HPSC001 hpsc001 = new HPSC001();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
this.dao.delete("HPSC001.delete", hpsc001.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 query(eiInfo);
}
/**
* 提交 撤回.
*/
@OperationLogAnnotation(operModul = "销售管理",operType = "提交")
public EiInfo check(EiInfo eiInfo) {
HPSC001 hpsc001 = new HPSC001();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
try {
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
DaoUtils.update("HPSC001.check", hpsc001.toMap());
if(hpsc001.getStatus() == 1){
Map sqlMap = new HashMap();
sqlMap.put("id",hpsc001.getId());
List<HPSC001> rows = this.dao.query("HPSC001.query",sqlMap);
if (rows.size()>0){
Map hppz003Map = new HashMap();
hppz003Map.put(HPPZ003.FIELD_CUST_CODE,rows.get(0).getPrinc2());
hppz003Map.put(HPPZ003.FIELD_CUST_TYPE,2); //提交变更为正式客户
DaoUtils.update(HPPZ003.UPDATE_CUST_CODE, hppz003Map);
}
eiInfo.getBlock(EiConstant.resultBlock).setRows(rows);
this.buildHPSC002(eiInfo);
}
}
} 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;
}
public void buildHPSC002(EiInfo eiInfo) {
HPSC001 hpsc001 = new HPSC001();
EiBlock eiBlock = eiInfo.getBlock(EiConstant.resultBlock);
List rows = new ArrayList();
for (int i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hpsc001.fromMap(map);
Map hpsc002 = new HashMap();
hpsc002.put("companyCode", hpsc001.getCompanyCode());
hpsc002.put("depCode", hpsc001.getDepCode());
hpsc002.put("projCode", hpsc001.getProjCode());
hpsc002.put("projName", hpsc001.getProjName());
hpsc002.put("parentId", "root"); //固定写死
hpsc002.put("parentPrdtName", hpsc001.getProjName());
hpsc002.put("deliveryDate",hpsc001.getDeliveryDate());
hpsc002.put("type", "");
hpsc002.put("leaf", "0");
hpsc002.put("sort", "");
hpsc002.put("icon", "");
hpsc002.put("prdtCode", hpsc001.getProjCode());
hpsc002.put("prdtName", hpsc001.getProjName());
rows.add(hpsc002);
}
eiBlock.setRows(rows);
eiInfo.set(EiConstant.serviceName, "HPSC002");
eiInfo.set(EiConstant.methodName, "insert");
EiInfo outInfo = XLocalManager.call(eiInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 项目下拉框
*
* @param inInfo
* @return
*/
public EiInfo queryComboBox(EiInfo inInfo) {
List<DdynamicEnum> list = new ArrayList<>();
list.add(DdynamicEnum.PROJ_RECORD_BLOCK_ID);
CommonMethod.initBlock(inInfo, list, EiInfoUtils.getFirstRow(inInfo));
return inInfo;
}
}
......@@ -142,6 +142,10 @@ public class ServiceHPSC102 extends ServiceEPBase {
hpsc002.fromMap(resultRow);
AssertUtils.isTrue(hpsc002.getStatus().equals(HPConstant.planStatus.S_1), "物料清单已提交,无法保存!");
if (hpsc002.getId() == null || hpsc002.getId() == 0) {
if (hpsc002.getPrdtType()==3){
HPSC002 hpsc0021= HPSCTools.HpSc002.getId(Long.parseLong(hpsc002.getParentId()));
AssertUtils.isTrue(hpsc0021.getStatus() == 1, "部件已提交,保存失败!");
}
this.add(hpsc002);
} else {
this.modify(hpsc002);
......@@ -213,7 +217,7 @@ public class ServiceHPSC102 extends ServiceEPBase {
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){
......@@ -225,12 +229,7 @@ public class ServiceHPSC102 extends ServiceEPBase {
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;
LogUtils.setDetailMsg(inInfo, e, "新增失败");
}
return inInfo;
......@@ -367,7 +366,7 @@ public class ServiceHPSC102 extends ServiceEPBase {
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());
......@@ -507,7 +506,7 @@ public class ServiceHPSC102 extends ServiceEPBase {
//hppz002.setDelStatus(CommonConstant.YesNo.NO_0.intValue());
//hppz002.setTotalWt(totalWt);
hppz002.setSpec(HPPZTools.HpPz006.jointSpec(hppz002.getLength(),hppz002.getWidth(),hppz002.getThick()));
DaoUtils.update("HPSC002.update", hppz002.toMap());
DaoUtils.update(HPSC002.UPDATE, hppz002.toMap());
//更新零件后,更新部件重量
if(hppz002.getPrdtType()==3){
this.updatePrdtWt(hppz002.getParentId());
......@@ -570,7 +569,7 @@ public class ServiceHPSC102 extends ServiceEPBase {
// 删除附件文件
delectDoc(fSc002.getId());
DaoUtils.update("HPSC002.delete", fSc002);
DaoUtils.update(HPSC002.DELETE, fSc002);
// 修改父级节点状态是叶子节点或非叶子节点
this.checkTreeNodeLeaf(fSc002.getParentId());
// 修改节点状态是叶子节点或非叶子节点
......@@ -846,14 +845,17 @@ public class ServiceHPSC102 extends ServiceEPBase {
List<String> factoryIds =HPXSTools.XsOrg.getOrgId(OrgTypeEnum.FACTORY.getCode());
AssertUtils.isEmpty(factoryIds,"工厂不存在");
Org org = HPXSTools.XsOrg.queryFactory(factoryIds.get(0));
HPSC002 hpsc002 =HPSCTools.HpSc002.getId(Long.parseLong(dbSc002.getParentId()));
if (dbSc003 == null) {
planNo = SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPSC003_PROD_NO);
HPSC003 newSc003 = BeanUtils.copy(dbSc002, HPSC003.class);
HPSC003 newSc003 = BeanUtils.copy(hpsc002, HPSC003.class);
newSc003.setPlanInfoNo(planNo);
newSc003.setMatId(dbSc002.getId());
newSc003.setMatId(hpsc002.getId());
newSc003.setFactoryCode(org.getOrgId());
newSc003.setPlanCompletionDate(dbSc002.getDeliveryDate());
newSc003.setPlanCompletionDate(hpsc002.getDeliveryDate());
newSc003.setStatus(HPConstant.planStatus.S_1);
newSc003.setPrdtCode(hpsc002.getPrdtCode());
newSc003.setPrdtName(hpsc002.getPrdtName());
DaoUtils.insert(HPSC003.INSERT, newSc003);
dbSc003 = newSc003;
} else {
......@@ -863,6 +865,7 @@ public class ServiceHPSC102 extends ServiceEPBase {
}
// 生产计划详情
List<HPSC002> dbSc002Children = HPSCTools.HpSc002.queryByParent(dbSc002.getParentId());
for (HPSC002 dbSc002Child : dbSc002Children) {
// 明细已存在就不在新增
HPSC004 dbSc004 = HPSCTools.HpSc004.queryByMat(dbSc002Child.getId());
......
......@@ -28,12 +28,10 @@ public class ServiceHPSC105 extends ServiceEPBase {
@Override
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.GROUP_RECORD_BLOCK_ID), null, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID, DdynamicEnum.GROUP_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPSC005B().eiMetadata);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "初始化失败");
inInfo.setStatus(500);
}
return inInfo;
}
......@@ -51,7 +49,6 @@ public class ServiceHPSC105 extends ServiceEPBase {
inInfo = super.query(inInfo, HPSC005B.QUERY, new HPSC005B());
} catch (Throwable e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
inInfo.setStatus(500);
}
return inInfo;
}
......
......@@ -3,6 +3,7 @@ package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.domain.HPSC106;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
......@@ -106,7 +107,8 @@ public class ServiceHPSC105B extends ServiceEPBase {
checkAddDate(hpsc106);
hpsc106.setWorkCode(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HGSC008_WORK_CODE));
DaoUtils.insert(HPSC106.INSERT,hpsc106);
//HGZLTools.THGZL002.add(hpsc106);
HPKCTools.HpKc003.addHpKc003(hpsc106);
return hpsc106;
}
......
......@@ -66,8 +66,11 @@
PROJ_CODE IN <iterate close=")" open="(" conjunction="," property="projCodes">#projCodes[]#</iterate>
</isNotEmpty>
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
$order$
</isNotEmpty>
<isEmpty property="orderBy">
STATUS,DELIVERY_DATE desc,CREATED_TIME desc
STATUS, CREATED_TIME desc, DELIVERY_DATE desc
</isEmpty>
</dynamic>
......
......@@ -19,10 +19,7 @@ import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -204,6 +201,32 @@ public class HPSCTools {
DaoUtils.update(HPSqlConstant.HPSC004.UPDATE_COMPLETE, newSc004);
}
/**
* 新增入库及删除入库单做同步计划订单
*
* @param prodOrderNo
* @param num
*/
public static void syncPlan(String prodOrderNo, BigDecimal num, BigDecimal wt) {
HPSC004 dbSc004 = HPSCTools.HpSc004.get(prodOrderNo);
AssertUtils.isNull(dbSc004, String.format("生产订单计划[%s]不存在", prodOrderNo));
BigDecimal completionNum = num.add(dbSc004.getActualCompletionNum());
AssertUtils.isGt(BigDecimal.ZERO, completionNum, "更新后的生产计划完成数量小于0,请检查");
BigDecimal completionUnitWt = wt.add(dbSc004.getActualCompletionUnitWt());
// 计算重量
HPSC004 newSc004 = new HPSC004();
newSc004.setId(dbSc004.getId());
newSc004.setActualCompletionNum(completionNum);
newSc004.setActualCompletionUnitWt(completionUnitWt);
// 计算是否生产完成
if (dbSc004.getNum().compareTo(completionNum) == 0) {
newSc004.setActualCompletionDate(DateUtils.shortDateTime());
} else {
newSc004.setActualCompletionDate("");
}
DaoUtils.update(HPSqlConstant.HPSC004.UPDATE_COMPLETE, newSc004);
}
public static void updateProjStatus(String projCode) {
AssertUtils.isNull(projCode, String.format("项目编码[%s]不能为空", projCode));
Map map3 = new HashMap();
......@@ -313,6 +336,15 @@ public class HPSCTools {
* @date:2024/2/4,10:17
*/
public static class HpSc002 {
public static HPSC002 getId(Long id) {
AssertUtils.isNull(id, "id不能为空");
Map queryMap = new HashMap();
queryMap.put("id", id);
List<HPSC002> results = DaoBase.getInstance().query("HPSC002.query", queryMap);
AssertUtils.isEmpty(results, String.format("id[%s]信息不存在", id));
return results.get(0);
}
/**
* 查询
......@@ -890,7 +922,17 @@ public class HPSCTools {
queryMap.put("prodTaskNos", prodTaskNos);
DaoBase.getInstance().update(HPSqlConstant.HPSC005A.LOCK, queryMap);
}
public static void lock(String prodTaskNo) {
if (CollectionUtils.isEmpty(Collections.singleton(prodTaskNo))) {
return;
}
List prodTaskNos = Arrays.asList(prodTaskNo);
Map queryMap = new HashMap();
queryMap.put("prodTaskNos", prodTaskNos);
DaoBase.getInstance().update(HPSqlConstant.HPSC005A.LOCK, queryMap);
}
/**
* 查询信息
*
......@@ -991,6 +1033,22 @@ public class HPSCTools {
/**
* 查询盘点单信息
*
* @param prodTaskNo
* @return
*/
public static List<HPSC005B> list(String prodTaskNo) {
if (CollectionUtils.isEmpty(Collections.singleton(prodTaskNo))) {
return null;
}
List prodTaskNos = Arrays.asList(prodTaskNo);
Map queryMap = new HashMap();
queryMap.put("prodTaskNos", prodTaskNos);
return DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
}
/**
* 查询盘点单信息
*
* @param prodTaskNos
* @return
*/
......@@ -1002,6 +1060,20 @@ public class HPSCTools {
queryMap.put("prodTaskNos", prodTaskNos);
return DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
}
/**
* 查询盘点单信息
*
* @param prodTaskNo
* @return
*/
public static Map<String, HPSC005B> map(String prodTaskNo) {
List<HPSC005B> results = list(prodTaskNo);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPSC005B::getProdTaskNo, item -> item));
}
/**
* 查询盘点单信息
......
......@@ -48,7 +48,7 @@ $(function () {
inspecDate =isBlank(inspecDate)?"": formatYYYYMMDD(inspecDate);
var ei = new EiInfo();
ei.set('inqu_status-0-factoryCode', $('#inqu_status-0-factoryCode').val());
ei.set('inqu_status-0-groupName', $('#inqu_status-0-groupName').val());
ei.set('inqu_status-0-groupCode', $('#inqu_status-0-groupCode').val());
ei.set('inqu_status-0-deviceType', $('#inqu_status-0-deviceType').val());
ei.set('inqu_status-0-deviceName', $('#inqu_status-0-deviceName').val());
ei.set('inqu_status-0-inspecDate', inspecDate);
......@@ -130,7 +130,7 @@ $(function () {
upkeepDate =isBlank(upkeepDate)?"": formatYYYYMMDD(upkeepDate);
var ei = new EiInfo();
ei.set('inqu_status-0-factoryCode', $('#inqu_status-0-factoryCode').val());
ei.set('inqu_status-0-groupName', $('#inqu_status-0-groupName').val());
ei.set('inqu_status-0-groupCode', $('#inqu_status-0-groupCode').val());
ei.set('inqu_status-0-deviceType', $('#inqu_status-0-deviceType').val());
ei.set('inqu_status-0-deviceName', $('#inqu_status-0-deviceName').val());
ei.set('inqu_status-0-upkeepDate', upkeepDate);
......@@ -149,7 +149,7 @@ $(function () {
pageSizes: [5, 10, 20, 50, 100],
},
columns: [
{
/*{
field: "operator",
title: "操作",
template: function (item) {
......@@ -160,7 +160,7 @@ $(function () {
}
return template;
}
}
}*/
],
exportGrid: {
exportFileName: function (gridInstance) {
......@@ -171,14 +171,14 @@ $(function () {
exportBlockId: "detail1", // 默认值和blockId相同,导出的EiInfo中的指定数据块被导出
},
query:function (e){
let upkeepDate = $('#inqu_status-0-upkeepDate').val();
upkeepDate =isBlank(upkeepDate)?"": formatYYYYMMDD(upkeepDate);
let recordDate = $('#inqu_status-0-recordDate').val();
recordDate =isBlank(recordDate)?"": formatYYYYMMDD(recordDate);
var ei = new EiInfo();
ei.set('inqu_status-0-factoryCode', $('#inqu_status-0-factoryCode').val());
ei.set('inqu_status-0-groupName', $('#inqu_status-0-groupName').val());
ei.set('inqu_status-0-groupCode', $('#inqu_status-0-groupCode').val());
ei.set('inqu_status-0-recordDate', recordDate);
ei.set('inqu_status-0-deviceType', $('#inqu_status-0-deviceType').val());
ei.set('inqu_status-0-deviceName', $('#inqu_status-0-deviceName').val());
ei.set('inqu_status-0-upkeepDate', upkeepDate);
return ei;
},
loadComplete: function(grid) {
......
......@@ -35,6 +35,7 @@
<EF:EFInput blockId="inqu_status" row="0" ename="deviceName" cname="设备名称" readonly="true" placeholder="模糊查询" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="inspecDate" cname="点检日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="upkeepDate" cname="保养日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
<EF:EFDatePicker blockId="inqu_status" row="0" ename="recordDate" cname="记录日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div>
</EF:EFRegion>
......@@ -70,12 +71,11 @@
</EF:EFRegion>
<EF:EFRegion id="detail1" title="安全记录">
<EF:EFGrid blockId="detail1" autoDraw="override" isFloat="true" queryMethod="queryDetail1">
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center"/>
<%--<EF:EFColumn ename="docId" cname="附件" width="100" enable="false" readonly="true" align="center"/>--%>
<EF:EFColumn ename="upkeepDate" cname="记录日期" width="120" enable="true" align="center" editType="date"
<EF:EFColumn ename="recordDate" cname="记录日期" width="120" enable="true" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFColumn ename="upkeepCode" cname="记录单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="checkDescrip" cname="安全事故描述" editType="textarea" width="160" align="center"/>
<EF:EFColumn ename="recordCode" cname="记录单号" width="100" enable="false" readonly="true" align="center" required="true"/>
<EF:EFColumn ename="secureDesc" cname="安全事故描述" editType="textarea" width="160" align="center"/>
<EF:EFColumn cname="记录人" ename="createdName" align="center" width="100" readonly="true" required="false" enable="false"/>
</EF:EFGrid>
</EF:EFRegion>
......
var prdtNameGlobalData = [];
var resultRows = [];
var princ2Data = [];
$(function () {
$("#QUERY").on("click", function () {
resultGrid.dataSource.page(1);
});
$("#DELETE").on("click", function () {
alert(1);
return false;
});
princ2Data = __eiInfo.getBlock("customer_record_block_id").getMappedRows();
var gridContainer=$("#ef_grid_result").data("kendoGrid");
IPLATUI.EFGrid= {
"result": {
pageable: {
pageSize: 5,
pageSizes: [5, 10, 20, 50, 100],
},
columns: [
{
field: "operator",
template: function (item) {
let auditStatus = item.status;
let template = '';
if (auditStatus) {
if (auditStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.id + ',1)" >提交</a>';
}
}
// else if (auditStatus == 1) {
// template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
// 'onclick="check(' + item.id + ',0)" >撤回</a>';
// }
return template;
}
},
{
field: "princ2Name",
title: "客户负责人",
/*query: function (container, options) {
let eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-inventTypes", [3, 4]);
eiInfo.set("inqu_status-0-inventType", options.model["prdtType"]);
return eiInfo;
}*/
template: function (dataItem) {
for (let i = 0; i < princ2Data.length; i++) {
if (princ2Data[i]['textField'] === dataItem['princ2Name']) {
//resultGrid.setCellValue(0, "princ2", princ2Data[i]['valueField']);
dataItem["princ2"] = princ2Data[i]['valueField'];
return princ2Data[i]['textField'];
}else if (!dataItem['princ2Name'] && princ2Data[i]['valueField'] === dataItem['princ2']){
return princ2Data[i]['textField'];
}
}
return dataItem["princ2Name"];
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
gridContainer = grid;
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoAutoComplete({
valuePrimitive: true,
dataSource: __eiInfo.getBlock("customer_record_block_id").getMappedRows(),
dataTextField: "textField",
dataValueField: "valueField",
required: "true",
optionLabelTemplate: "#:textField#",
valueTemplate: "#:valueField#",
template: "#:textField#",
filter: "contains"
});
input.data("kendoAutoComplete").search();
},
/*afterEdit: function (e) {
for (let i = 0; i < princ2Data.length; i++) {
if (princ2Data[i]['valueField'] === dataItem['princ2']) {
//resultGrid.setCellValue(0, "princ2", princ2Data[i]['valueField']);
e.model["princ2"]= princ2Data[i]['valueField'];
}
}
}*/
}
],
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
saveFunc();
},
onDelete: function (e) {
// 阻止默认请求,使用自定义删除
e.preventDefault();
deleteFunc();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'save' || e.eiInfo.extAttr.methodName == 'delete') {
query();
}
},
onRowClick: function (e) {
if (e.model['status']==1){
var block = detailGrid.getEiBlock();
if (block != null) {
block.setRows([]);
detailGrid.setEiBlock(block);
}
resultRows = e.model;
/*var info = new EiInfo()
var projCode = e.model['projCode'];
info.set("inqu_status-0-projCode", projCode);
info.set("inqu_status-0-lv", 2);
queryDetail(info);*/
}else {
resultRows = [];
}
var projCode = e.model['projCode'];
if (projCode.length>0){
var info = new EiInfo()
info.set("inqu_status-0-projCode", projCode);
info.set("inqu_status-0-lv", 2);
queryDetail(info);
}
}
},
"detail":{
/*toolbarConfig: {
// hidden: false, // true时,不显示功能按钮,但保留setting导出按钮
// add: false, // 不显示新增按钮
cancel: true, // 不显示取消按钮
// save: true, // 不显示保存按钮
// delete: true, // 显示删除按钮
},*/
onAdd: function (e) {
if (resultRows['status']==1){
let detailRoot;
var info = new EiInfo()
var projCode = resultRows.projCode;
info.set("inqu_status-0-parentId","root");
info.set("inqu_status-0-projCode", projCode);
info.set("inqu_status-0-lv", 1);
EiCommunicator.send("HPSC002", "queryList", info, {
onSuccess: function (ei) {//返回结果集
detailRoot = ei.getBlock("detail").getMappedRows();
//detailGrid.setEiInfo(ei);
}, onFail: function (ei) {
}
}, {async: false});
for (let i = 0; i < e.items.length; i++) {
e.items[i]["parentId"] = detailRoot[0].id;
e.items[i]['projCode'] = resultRows.projCode;
e.items[i]['projName'] = resultRows.projName;
e.items[i]['parentPrdtName'] = resultRows.projName;
e.items[i]['deliveryDate'] = resultRows.deliveryDate;
e.items[i]['prdtType'] = 4;
e.items[i]['lv'] = 2;
$("#locked_datacell_0_"+i+" input").attr("checked",true);
}
}else {
e.preventDefault();
message("请先提交销售单");
return;
}
},
onSave: function (e) {
// 阻止默认请求,使用自定义保存
e.preventDefault();
let btnNode = $(this);
//禁用按钮
btnNode.attr("disabled", true);
saveDetail(btnNode);
},
onDelete: function (e) {
e.preventDefault();
deleteDetail();
},
onSuccess: function (e) {
if (e.eiInfo.extAttr.methodName == 'delete'
|| e.eiInfo.extAttr.methodName == 'insert') {
query();
}
},
columns: [
{
field: "operator",
title: "操作",
template: function (item) {
let template = '';
if (item.id){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + item.id + ')" >附件清单</a>';
}
return template;
}
},
{
field: "prdtType",
title: "部件类型",
filter: function (options) {
// 返回我们过滤后的数据集
return _.filter(options.values, function (item) {
return item["valueField"]==4;
})
}
},
{
field: "prdtName",
title: "部件名称",
template: function (dataItem) {
for (let i = 0; i < prdtNameGlobalData.length; i++) {
if (prdtNameGlobalData[i]['textField'] === dataItem['prdtName']) {
//dataItem["prdtCode"] = prdtNameGlobalData[i]['valueField']
detailGrid.setCellValue(0, "prdtCode", prdtNameGlobalData[i]['valueField']);
return prdtNameGlobalData[i]['textField'];
}
}
return dataItem["prdtName"];
},
editor: function (container, options) {
var grid = container.closest(".k-grid").data("kendoGrid");
var cellIndex = grid.cellIndex(container);
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
let eiInfo = new EiInfo();
eiInfo.set("inventType", 4);
eiInfo.set("isSplicingSymbol", false);
var dataSource;
EiCommunicator.send("HPPZ004", "queryComboBox", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_name_block_id").getMappedRows();
prdtNameGlobalData = dataSource;
},
onFail: function (ei) {
}
}, {async: false});
input.kendoAutoComplete({
valuePrimitive: true,
dataSource: dataSource,
dataTextField: "textField",
dataValueField: "valueField",
required: "true",
optionLabelTemplate: "#:textField#",
valueTemplate: "#:valueField#",
template: "#:textField#",
filter: "contains"
});
input.data("kendoAutoComplete").search();
}
}
]
}
}
window.document.addEventListener("keyup",function (event) {
if(event.keyCode === 13){
var grid = $("#ef_grid_result").data("kendoGrid");
// 回填
//grid.addRows(returnRows);
grid.closeCell();
}
})
});
function check(id, auditStatus) {
const inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
inEiInfo.set("result-0-status", auditStatus);
EiCommunicator.send('HPSC001', 'check', inEiInfo, {
onSuccess(response) {
//NotificationUtil(response.msg);
message("提交成功,已生成项目档案");
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
/**
* 保存
*/
function saveFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let projType= item.get("projType");
let projName= item.get("projName");
let princ1= item.get("princ1");
//let princ2= item.get("princ2");
if(isBlank(projType)){
message("选中的第"+(index+1)+"行\"项目类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(projName)){
message("选中的第"+(index+1)+"行\"项目名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(princ1)){
message("选中的第"+(index+1)+"行\"项目负责人\",不能为空!");
flag = false;
return false;
}
/*if(isBlank(princ2)){
message("选中的第"+(index+1)+"行\"客户负责人\",不能为空!");
flag = false;
return false;
}*/
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("result"));
EiCommunicator.send("HPSC001", "save", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
try {
princ2Data =ei.getBlock("customer_record_block_id").getMappedRows();
//queryCustCode();
resultGrid.setEiInfo(ei);
} catch (e) {
// TODO: handle exception
}
if (ei.getStatus() == 0) {
NotificationUtil(ei, 'warning');
} else {
NotificationUtil(ei);
}
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
//JSUtils.submitGridsData("result", "HPSC001", "save", true);
}
});
}
}
/**
* 删除
*/
function deleteFunc() {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(status==="1"){
message("选中的第"+(index+1)+"行记录已提交,不能删除!");
flag = false;
return false;
}
});
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPSC001", "delete", true);
}
});
}
}
function query() {
resultGrid.dataSource.page(1);
}
function queryDetail(inInfo) {
EiCommunicator.send("HPSC002", "queryDetail", inInfo, {
onSuccess: function (ei) {//返回结果集
detailGrid.setEiInfo(ei);
}, onFail: function (ei) {
}
}, {async: false});
}
function saveDetail() {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let prdtType= item.get("prdtType");
let prdtName= item.get("prdtName");
let num= item.get("num");
let unitWt= item.get("unitWt");
if(isBlank(prdtType)){
message("选中的第"+(index+1)+"行\"部件类型\",不能为空!");
flag = false;
return false;
}
if(isBlank(prdtName)){
message("选中的第"+(index+1)+"行\"部件名称\",不能为空!");
flag = false;
return false;
}
if (!isPositiveInteger(num)) {
message("勾选的第" + (index + 1) + "行\"数量\"必须是大于0的整数");
flag = false;
return;
}
if(isBlank(unitWt)){
message("选中的第"+(index+1)+"行\"单重\",不能为空!");
flag = false;
return false;
}
let pgStatus= item.get("pgStatus");
if(pgStatus==="1"||pgStatus==="2"){
message("选中的第"+(index+1)+"行记录已派工,不能修改!");
flag = false;
return false;
}
});
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
//JSUtils.submitGridsData("detail", "HPSC002", "saveDetail", true);
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail"));
EiCommunicator.send("HPSC002", "saveDetail", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
var info = new EiInfo()
info.set("inqu_status-0-projCode", resultRows.projCode);
info.set("inqu_status-0-lv", 2);
queryDetail(info);
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
});
}
}
function deleteDetail() {
let rows = detailGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let status= item.get("status");
if(status==="1"){
message("选中的第"+(index+1)+"行记录已提交,不能删除!");
flag = false;
return false;
}
});
if(flag){
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"删除\"操作? ", {
ok: function () {
//JSUtils.submitGridsData("detail", "HPSC002", "deleteDetail", true);
var info = new EiInfo();
info.addBlock(JSUtils.checkedRows2Block("detail"));
EiCommunicator.send("HPSC002", "deleteDetail", info, {
onSuccess: function (ei) {
if (ei.getStatus() >= 0) {
var info = new EiInfo()
info.set("inqu_status-0-projCode", resultRows.projCode);
info.set("inqu_status-0-lv", 2);
queryDetail(info);
} else {
NotificationUtil(ei, "error");
}
},
onFail: function (ei) {
// 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error");
}
});
}
});
}
}
/**
* 显示附件清单
*
* @param id
*/
function showUploadFile(id) {
JSColorbox.open({
href: "HPSC002A?methodName=initLoad&inqu_status-0-bizType=WL&inqu_status-0-matId=" + id,
title: "<div style='text-align: center;'>附件清单</div>",
width: "80%",
height: "80%",
});
}
/**
* 查询客户
*/
function queryCustCode() {
let eiInfo = new EiInfo();
var dataSource;
EiCommunicator.send("HPPZ003", "queryCustCode", eiInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("customer_record_block_id").getMappedRows();
princ2Data = dataSource;
},
onFail: function (ei) {
}
}, {async: false});
}
\ No newline at end of file
<%--
Created by IntelliJ IDEA.
User: 1
Date: 2024/8/15
Time: 9:15
To change this template use File | Settings | File Templates.
--%>
<!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}"/>
<head>
<%-- <link rel="stylesheet" href="${ctx}/css/simulatedOperation.css"/>--%>
</head>
<EF:EFPage title="销售管理">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFInput ename="inqu_status-0-projCode" cname="项目编码" colWidth="3"/>
<EF:EFInput ename="inqu_status-0-projName" cname="项目名称" colWidth="3"/>
<EF:EFSelect ename="inqu_status-0-projType" cname="项目类型" colWidth="3" filter="contains"
template="#=textField#" valueTemplate="#=textField#">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpsc.projType"/>
</EF:EFSelect>
<EF:EFSelect cname="单据状态" optionLabel="全部" ename="inqu_status-0-status" colWidth="3">
<EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="已提交" value="1"/>
</EF:EFSelect>
<EF:EFSelect cname="项目负责人" ename="inqu_status-0-princ1" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="user_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFSelect cname="客户负责人" ename="inqu_status-0-princ2" colWidth="3" filter="contains" defultValue="">
<EF:EFOption label="全部" value=""/>
<EF:EFOptions blockId="customer_record_block_id" textField="textField" valueField="valueField"/>
</EF:EFSelect>
<EF:EFDatePicker ename="inqu_status-0-deliveryDate" cname="交货日期" role="date" format="yyyy-MM-dd" parseFormats="['yyyyMMdd']" colWidth="3"/>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="记录集">
<EF:EFGrid blockId="result" autoDraw="no" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" width="100" align="center"/>
<EF:EFComboColumn ename="projType" cname="项目类型" width="100" align="center" required="true"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true">
<EF:EFCodeOption codeName="hpjx.hpsc.projType"/>
</EF:EFComboColumn>
<EF:EFColumn required="true" ename="projName" cname="项目名称" readonly="true"/>
<EF:EFComboColumn ename="princ1" cname="项目负责人" width="120" align="center" required="true"
blockName="user_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains">
</EF:EFComboColumn>
<EF:EFColumn ename="princ2" cname="客户负责人" width="120" align="center" maxLength="50" hidden="true"/>
<EF:EFColumn ename="princ2Name" cname="客户负责人" width="120" align="center" maxLength="50" required="true"/>
<%--<EF:EFComboColumn ename="princ2" cname="客户负责人" width="120" align="center" required="true"
blockName="customer_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="true"
filter="contains">
</EF:EFComboColumn>--%>
<EF:EFColumn ename="deliveryDate" cname="交货日期" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFComboColumn ename="status" cname="状态" enable="false" width="100" align="center" defaultValue="0">
<EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="已提交" value="1"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" editType="textarea"/>
</EF:EFGrid>
</EF:EFRegion>
<EF:EFRegion id="detail" title="明细信息">
<EF:EFGrid blockId="detail" autoDraw="no" isFloat="true">
<EF:EFColumn ename="id" cname="主键" hidden="true"/>
<EF:EFColumn ename="lv" cname="层级" defaultValue="2" hidden="true"/>
<EF:EFColumn ename="projCode" cname="项目编码" enable="false" hidden="true"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" hidden="true"/>
<EF:EFColumn ename="parentId" cname="上级部件名称" enable="false" hidden="true"/>
<EF:EFColumn ename="parentPrdtName" cname="上级部件名称" enable="false" hidden="true"/>
<EF:EFColumn ename="status" cname="提交状态" enable="false" hidden="true"/>
<EF:EFColumn ename="pgStatus" cname="派工状态" enable="false" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="120" align="center" hidden="true"/>
<EF:EFComboColumn ename="prdtType" cname="部件类型" align="center" required="true"
filter="contains" width="90" enable="false" hidden="true">
<EF:EFOptions blockId="codeset_code_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="prdtCode" cname="部件编码" hidden='true'/>
<EF:EFColumn ename="prdtName" cname="部件名称" width="140" align="center" maxLength="50" required="true"/>
<EF:EFColumn ename="length" cname="长(MM)" width="80" format="{0:N0}" maxLength="12" displayType="0.000"
data-regex="/^-?[0-9]{1,9}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置9位整数!"/>
<EF:EFColumn ename="width" cname="宽(MM)" width="80" format="{0:N0}" maxLength="12" displayType="0.000"
data-regex="/^-?[0-9]{1,9}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置9位整数!"/>
<EF:EFColumn ename="thick" cname="厚(MM)" width="80" format="{0:N0}" maxLength="12" displayType="0.000"
data-regex="/^-?[0-9]{1,9}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置9位整数!"/>
<EF:EFColumn ename="deliveryDate" cname="交货日期" width="100" editType="date" required='true' align="center"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="num" cname="数量" maxLength="15" displayType="0.000" format="{0:N0}%" required="true"
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/" defaultValue="100"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"/>
<EF:EFColumn ename="unitWt" format="{0:N3}" cname="单重(T)" maxLength="15" displayType="0.000" required="true"
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/" defaultValue="0" hidden = "true"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"/>
<EF:EFColumn ename="totalWt" cname="总重(T)" enable="false" width="100" align="right" format="{0:N3}" defaultValue="0" hidden="true"/>
<EF:EFColumn ename="remark" cname="备注" editType="textarea"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
......@@ -268,11 +268,11 @@ $(function () {
let eiInfo = new EiInfo();
let selectTreeNode = IPLATUI.EFTree.materialTree.selectTreeNode;
if (selectTreeNode.lv == 1) {
eiInfo.set("inventType", 4);
eiInfo.set("inqu_status-0-inventType", 4);
} else if (selectTreeNode.lv == 2) {
eiInfo.set("inventTypes", [2, 3]);
eiInfo.set("inqu_status-0-inventTypes", [2, 3]);
} else {
eiInfo.set("inventTypes", [3, 4]);
eiInfo.set("inqu_status-0-inventTypes", [3, 4]);
}
eiInfo.set("isSplicingSymbol", false);
var dataSource;
......@@ -310,7 +310,7 @@ $(function () {
}
}, {
field: "num",
format: "{0:N2}",
format: "{0:N0}",
template: function (dataItem) {
return kendo.format("{0:N0}%",+dataItem.num);
}
......
......@@ -63,8 +63,7 @@
<EF:EFOptions blockId="codeset_code_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFColumn ename="prdtCode" cname="部件编码" hidden='true'/>
<EF:EFColumn ename="prdtName" cname="部件名称" width="140" align="center" maxLength="50"
required="true"/>
<EF:EFColumn ename="prdtName" cname="部件名称" width="140" align="center" maxLength="50" required="true"/>
<EF:EFColumn ename="length" cname="长/φ(MM)" width="80" format="{0:N0}" maxLength="12" displayType="0"
data-regex="/^-?[0-9]{1,9}$/"
data-errorprompt="请输入数字,该值最大可设置9位整数!"/>
......@@ -76,7 +75,7 @@
data-errorprompt="请输入数字,该值最大可设置9位整数!"/>
<EF:EFColumn enable="false" ename="parentId" hidden="true" cname="上级部件名称"/>
<EF:EFColumn enable="false" ename="parentPrdtName" hidden="true" cname="上级部件名称"/>
<EF:EFColumn ename="num" cname="数量" maxLength="15" displayType="0.000"
<EF:EFColumn ename="num" cname="数量" maxLength="15" displayType="0.000" defaultValue = '100'
data-regex="/^-?[0-9]{1,12}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置12位整数和3位小数!"/>
<EF:EFColumn ename="totalWt" cname="总重(T)" enable="true" width="100" align="right" format="{0:N3}" sumType="all"
......@@ -92,7 +91,7 @@
<EF:EFOption label="未提交" value="0"/>
<EF:EFOption label="已提交" value="1"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" />
<EF:EFColumn ename="remark" cname="备注" editType="textarea"/>
</EF:EFGrid>
</EF:EFRegion>
</div>
......
......@@ -15,28 +15,28 @@ $(function () {
pageSize: 20,
pageSizes: [10, 20, 50, 70, 100],
},
columns: [{
field: "operator",
template: function (item) {
let status = item.status;
let prodOrderNo = item.prodOrderNo;
let filePath1 = item.filePath1;
let template = '';
// 非全部派工时展示拆单派工按钮
if (status != 2) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="tearAssign(\'' + prodOrderNo + '\')" >拆单派工</a>';
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showGroupDetail(\'' + prodOrderNo + '\')" >任务详情</a>';
if (filePath1) {
columns: [
{
field: "operator",
template: function (item) {
let status = item.status;
let prodOrderNo = item.prodOrderNo;
let filePath1 = item.filePath1;
let template = '';
// 非全部派工时展示拆单派工按钮
if (status != 2) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="tearAssign(\'' + prodOrderNo + '\')" >拆单派工</a>';
}
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ')" >附件</a>';
+ 'onclick="showGroupDetail(\'' + prodOrderNo + '\')" >任务详情</a>';
if (filePath1) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showUploadFile(' + filePath1 + ')" >附件</a>';
}
return template
}
return template
}
},
},
{
field: "prodOrderNo",
template: function (item) {
......@@ -46,9 +46,7 @@ $(function () {
+' onclick="tearDetails(\'' + prodOrderNo + '\')" >' + prodOrderNo + '</a>';
return template
}
}
]
}
});
......
......@@ -60,8 +60,8 @@
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="planCompletionDate" cname="计划完成日期" enable="false" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="assignedNum" cname="派工数量" enable="false" width="80" align="right" format="{0:N0}%"/>
<EF:EFColumn ename="unassignedNum" cname="剩余数量" enable="false" width="80" align="right" format="{0:N0}%"/>
<%--<EF:EFColumn ename="assignedNum" cname="派工数量" enable="false" width="80" align="right" format="{0:N0}%"/>
<EF:EFColumn ename="unassignedNum" cname="剩余数量" enable="false" width="80" align="right" format="{0:N0}%"/>--%>
<EF:EFColumn ename="num" cname="数量" enable="false" width="80" align="right" format="{0:N0}%"/>
<EF:EFColumn ename="totalWt" cname="总重(T)" enable="false" width="80" align="right" format="{0:N3}"/>
<%--<EF:EFColumn ename="remark" cname="部件备注" enable="false"/>--%>
......
......@@ -32,7 +32,7 @@ $(function () {
message("报工数量必须是大于0的正整数");
return ;
}
if (unregisterQuantity<quantity){
if (unregisterQuantity-quantity < 0){
message("报工数量不能大于剩余数量");
return ;
}
......
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