Commit 0ebe7125 by liuyang

Merge branch 'dev' of http://git.pseer.com:8800/platform/hg-smart into dev-ly

parents cdcd5ab5 ccf1ac48
......@@ -329,6 +329,21 @@ public class HGConstant {
// 退库
public static final Integer TK = 2;
}
/**
*
* 生产入库单类型
* @author:jianghesong
* @date:2024/5/15,15:18
*/
public static class StorageType {
// 默认
public static final Integer DEFAULT = 0;
// 入库
public static final Integer RK = 1;
// 退回
public static final Integer TH = 2;
}
/**
* 文件类型*
......
......@@ -128,6 +128,7 @@ public class HGKC003 extends DaoEPBase {
public static final String DELETE = "HGKC003.delete";
public static final String UPDATE_SUBMIT_STATUS = "HGKC003.updateSubmitStatus";
public static final String MAX_ID = "HGKC003.maxId";
public static final String BATCH_DELETE = "HGKC003.batchDelete";
private Long id = new Long(0);
private Long qualityId = new Long(0); /* 质检单id*/
......@@ -156,14 +157,14 @@ public class HGKC003 extends DaoEPBase {
private String prodTaskNo = " "; /* 生产任务号*/
private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/
private Integer prdtType; /* 产品类型*/
private String prdtType; /* 产品类型*/
private String prdtCode = " "; /* 产品编码*/
private String prdtName = " "; /* 产品名称*/
private BigDecimal prdtLength = new BigDecimal(0.000); /* 产品-长*/
private BigDecimal prdtWidth = new BigDecimal(0.000); /* 产品-宽*/
private BigDecimal prdtThick = new BigDecimal(0.000); /* 产品-厚*/
private String prdtSpec = " "; /* 产品规格*/
private Integer partType; /* 零件类型*/
private String partType; /* 零件类型*/
private String partCode = " "; /* 零件编码*/
private String partName = " "; /* 零件名称*/
private BigDecimal partLength = new BigDecimal(0.000); /* 零件-长*/
......@@ -176,7 +177,7 @@ public class HGKC003 extends DaoEPBase {
private BigDecimal partCoefficient = new BigDecimal(0.000); /* 零件-系数*/
private BigDecimal price = new BigDecimal("0"); /* 单价*/
private BigDecimal amount = new BigDecimal("0"); /* 金额*/
private Boolean storageType; /* 入库类型:0:入库 1:退回*/
private Integer storageType; /* 入库类型:0:入库 1:退回*/
/**
* initialize the metadata.
......@@ -843,7 +844,7 @@ public class HGKC003 extends DaoEPBase {
* get the prdtType - 产品类型.
* @return the prdtType
*/
public Integer getPrdtType() {
public String getPrdtType() {
return this.prdtType;
}
......@@ -852,7 +853,7 @@ public class HGKC003 extends DaoEPBase {
*
* @param prdtType - 产品类型
*/
public void setPrdtType(Integer prdtType) {
public void setPrdtType(String prdtType) {
this.prdtType = prdtType;
}
/**
......@@ -955,7 +956,7 @@ public class HGKC003 extends DaoEPBase {
* get the partType - 零件类型.
* @return the partType
*/
public Integer getPartType() {
public String getPartType() {
return this.partType;
}
......@@ -964,7 +965,7 @@ public class HGKC003 extends DaoEPBase {
*
* @param partType - 零件类型
*/
public void setPartType(Integer partType) {
public void setPartType(String partType) {
this.partType = partType;
}
/**
......@@ -1120,11 +1121,11 @@ public class HGKC003 extends DaoEPBase {
this.amount = amount;
}
public Boolean getStorageType() {
public Integer getStorageType() {
return storageType;
}
public void setStorageType(Boolean storageType) {
public void setStorageType(Integer storageType) {
this.storageType = storageType;
}
......@@ -1163,14 +1164,14 @@ public class HGKC003 extends DaoEPBase {
setProdTaskNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROD_TASK_NO)), prodTaskNo));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName));
setPrdtType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_PRDT_TYPE)), prdtType));
setPrdtType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_TYPE)), prdtType));
setPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_CODE)), prdtCode));
setPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_NAME)), prdtName));
setPrdtLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_LENGTH)), prdtLength));
setPrdtWidth(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_WIDTH)), prdtWidth));
setPrdtThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_THICK)), prdtThick));
setPrdtSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_SPEC)), prdtSpec));
setPartType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_PART_TYPE)), partType));
setPartType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_TYPE)), partType));
setPartCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_CODE)), partCode));
setPartName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_NAME)), partName));
setPartLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_LENGTH)), partLength));
......@@ -1183,7 +1184,7 @@ public class HGKC003 extends DaoEPBase {
setPartCoefficient(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_COEFFICIENT)), partCoefficient));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount));
setStorageType(NumberUtils.toBoolean(StringUtils.toString(map.get(FIELD_STORAGE_TYPE)), storageType));
setStorageType(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_STORAGE_TYPE)), storageType));
}
/**
......
......@@ -6,7 +6,9 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC003;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.hg.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -17,8 +19,10 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @author:songx
......@@ -36,9 +40,7 @@ public class ServiceHGKC003 extends ServiceBase {
@OperationLogAnnotation(operModul = "生产入库单", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_CODE_BLOCK_ID,DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC003().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
......@@ -56,8 +58,7 @@ public class ServiceHGKC003 extends ServiceBase {
@OperationLogAnnotation(operModul = "生产入库单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) {
try {
// Map queryRow = EiInfoUtils.getFirstRow(inInfo);
// HGKCUtils.HgKc003.setCondition(queryRow);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_CODE_BLOCK_ID,DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID));
inInfo = super.query(inInfo, HGKC003.QUERY, new HGKC003());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
......@@ -66,6 +67,33 @@ public class ServiceHGKC003 extends ServiceBase {
}
/**
* 保存操作.
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "生产入库单", operType = "保存", operDesc = "保存")
public EiInfo update(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 写入数据
for (int i = 0; i < resultRows.size(); i++) {
HGKC003 hgkc003 = new HGKC003();
hgkc003.fromMap(resultRows.get(i));
// 数据校验
this.checkSubmitData(hgkc003);
DaoUtils.update(HGKC003.UPDATE, hgkc003);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
......@@ -75,14 +103,15 @@ public class ServiceHGKC003 extends ServiceBase {
public EiInfo delete(EiInfo inInfo) {
try {
List<HGKC003> fKc003s = MapUtils.toDaoEPBase(inInfo, HGKC003.class);
// 锁库存
Map<String, HGKC003> dbKc003Map = HGKCUtils.HgKc003.lockGetDataEp(fKc003s);
// 锁生产计划明细
// HPSCTools.HpSc004.lock(prodOrderNos);
// 校验数据
this.checkDeleteData(fKc003s, dbKc003Map);
// 查询数据
this.deleteData(fKc003s, dbKc003Map);
// 生产入库单ids
List<Long> ids = fKc003s.stream().map(HGKC003::getId).collect(Collectors.toList());
for(Long id : ids){
HGKC003 hgkc003 = HGKCTools.HgKc003.getId(id);
//修改计划生产任务完工数量
HGSCTools.hgkc003Delete(hgkc003.getQualityId(),hgkc003.getInvQty().negate().intValue(),hgkc003.getRectificationId());
DaoUtils.update(HGKC003.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
}
inInfo.setMsg("删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
......@@ -91,16 +120,12 @@ public class ServiceHGKC003 extends ServiceBase {
}
/**
* @param fKc003s
* @param dbKc003Map
* @param fKc003
*/
private void checkDeleteData(List<HGKC003> fKc003s, Map<String, HGKC003> dbKc003Map) {
for (HGKC003 fKc003 : fKc003s) {
String depositNo = fKc003.getDepositNo();
HGKC003 dbKc003 = dbKc003Map.get(depositNo);
AssertUtils.isEquals(DeleteFlagEnum.REMOVE.getCode(), dbKc003.getDeleteFlag(),
String.format("入库单【%s】已删除,请勿重复操作", depositNo));
}
private void checkBackData(HGKC003 fKc003) {
AssertUtils.isEquals(DeleteFlagEnum.REMOVE.getCode(), fKc003.getDeleteFlag(),
String.format("入库单【%s】已删除,请勿重复操作", fKc003.getDepositNo()));
AssertUtils.isTrue(fKc003.getSubmitStatus().compareTo(HGConstant.ProductStatus.WTJ) == 0,"入库单"+fKc003.getDepositNo()+"未提交,请勿退回");
}
......@@ -117,7 +142,16 @@ public class ServiceHGKC003 extends ServiceBase {
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgkc003.fromMap(map);
hgkc003 = HGKCTools.HgKc003.getId(hgkc003.getId());
// 校验数据
this.checkSubmitData(hgkc003);
DaoUtils.update(HGKC003.UPDATE_SUBMIT_STATUS, hgkc003);
// 修改库存
HGKCUtils.HgKc010.updateInv(hgkc003.getCompanyCode(), hgkc003.getWhCode(), hgkc003.getPartSpecId(),
hgkc003.getInvQty(), hgkc003.getInvWeight());
//修改计划生产任务完工数量
HGSCTools.complete(hgkc003.getQualityId(),hgkc003.getInvQty().intValue(),hgkc003.getRectificationId());
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "提交")});
......@@ -132,33 +166,62 @@ public class ServiceHGKC003 extends ServiceBase {
return inInfo;
}
private void checkSubmitData(HGKC003 hgkc003) {
AssertUtils.isEmpty(hgkc003.getWhCode(),"仓库编码不能为空!");
AssertUtils.isEmpty(hgkc003.getWhName(),"仓库名称不能为空!");
AssertUtils.isNull(hgkc003.getPrice(),"单价不能为空!");
}
/**
* 删除数据
* 退回操作
* @param inInfo
* @return
*/
public EiInfo sendBack(EiInfo inInfo){
int i = 0;
try {
HGKC003 hgkc003 = new HGKC003();
EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i);
hgkc003.fromMap(map);
hgkc003 = HGKCTools.HgKc003.getId(hgkc003.getId());
// 校验数据
this.checkBackData(hgkc003);
// 退回数据
this.sendBackOption(hgkc003);
}
inInfo.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "退回")});
} catch (PlatException e) {
e.printStackTrace();
inInfo.setStatus(EiConstant.STATUS_FAILURE);
ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
}
return inInfo;
}
/**
* 退回数据
*
* @param fKc003s
* @param dbKc003Map
* @param fKc003
*/
private void deleteData(List<HGKC003> fKc003s, Map<String, HGKC003> dbKc003Map) {
for (HGKC003 fKc003 : fKc003s) {
fKc003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
DaoUtils.update(HGKC003.DELETE, fKc003);
private void sendBackOption(HGKC003 fKc003) {
// 生产一条负数量和产量的红冲记录
HGKC003 dbKc003 = dbKc003Map.get(fKc003.getDepositNo());
HGKC003 newKc003 = BeanUtils.copy(dbKc003, HGKC003.class);
newKc003.setInvQty(dbKc003.getInvQty().negate());
newKc003.setInvWeight(dbKc003.getInvWeight().negate());
newKc003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode());
HGKC003 newKc003 = BeanUtils.copy(fKc003, HGKC003.class);
newKc003.setInvQty(fKc003.getInvQty().negate());
newKc003.setInvWeight(fKc003.getInvWeight().negate());
newKc003.setDepositNoOld(fKc003.getDepositNo());
newKc003.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROD_DEPOSIT_NO));
fKc003.setStorageType(HGConstant.StorageType.TH);
DaoUtils.insert(HGKC003.INSERT, newKc003);
// 同步生产计划
// HPSCTools.syncPlan(newKc003.getProdOrderNo(), newKc003.getAmount());
// 更新生产任务已完成数量
// HPSCTools.HpSc005a.updateCompleteNum(newKc003.getProdTaskNo(), newKc003.getAmount());
// 修改库存
HGKCUtils.HgKc011.updateInv(newKc003.getCompanyCode(), newKc003.getWhCode(), newKc003.getProdOrderNo(),
HGKCUtils.HgKc010.updateInv(newKc003.getCompanyCode(), newKc003.getWhCode(), newKc003.getPartSpecId(),
newKc003.getInvQty(), newKc003.getInvWeight());
}
//修改计划生产任务完工数量
HGSCTools.complete(fKc003.getQualityId(),newKc003.getInvQty().intValue(),fKc003.getRectificationId());
}
}
......@@ -200,7 +200,7 @@
AMOUNT as "amount", <!-- 金额 -->
STORAGE_TYPE as "storageType", <!-- 入库类型:0:入库 1:退回 -->
SUBMIT_STATUS as "submitStatus" <!-- 提交状态 -->
FROM ${hggpSchema}.HGKC003 WHERE 1=1
FROM ${hggpSchema}.HGKC003 WHERE 1=1 AND DELETE_FLAG = 0
<include refid="condition" />
<dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy">
......@@ -281,12 +281,11 @@
</insert>
<delete id="delete">
DELETE FROM ${hggpSchema}.HGKC003 WHERE
ID = #id#
UPDATE ${hggpSchema}.HGKC003 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete>
<delete id="batchDelete">
DELETE FROM ${hggpSchema}.HGKC003 WHERE
UPDATE ${hggpSchema}.HGKC003 SET DELETE_FLAG = 1 WHERE
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</delete>
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baosight.hggp.common.CheckTypeEnum;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.*;
......@@ -12,6 +13,7 @@ import com.baosight.hggp.hg.pz.tools.HGPZTools;
import com.baosight.hggp.hg.zl.domain.HGZL002;
import com.baosight.hggp.hg.zl.domain.HGZL004;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
......@@ -133,6 +135,22 @@ public class HGKCTools {
*/
public static class HgKc003 {
/**
* 生产入库单信息
*
* @param id
* @return
*/
public static HGKC003 getId(Long id) {
AssertUtils.isEmpty(Collections.singleton(id), "生产入库单为空!");
Map<String, Object> paramMap = new HashMap();
paramMap.put("id", id);
paramMap.put("deleteFlag", 0);
List<HGKC003> list = DaoBase.getInstance().query(HGKC003.QUERY, paramMap);
AssertUtils.isEmpty(list, "生产入库单为空!");
return list.get(0);
}
public static HGKC003 save(HGKC003 hgkc003,List<HGKC003A> hgkc003aList){
checkSaveData(hgkc003,hgkc003aList);
......@@ -178,15 +196,16 @@ public class HGKCTools {
*/
public static void putInStorageData(List<HGZL002> hgzl002List) {
List<HGKC003> hgkc003List = new LinkedList<>();
setHgkc003Data(hgzl002List,hgkc003List, null);
setHgkc003Data(hgzl002List,hgkc003List, null, null);
DaoUtils.insertBatch(HGKC003.INSERT,hgkc003List);
}
/**
* 对象赋值(工序质检单)
* @param hgzl002List
* @param code
* @param hgzl004List
*/
private static void setHgkc003Data(List<HGZL002> hgzl002List, List<HGKC003> hgkc003List, Integer code) {
private static void setHgkc003Data(List<HGZL002> hgzl002List, List<HGKC003> hgkc003List, Integer code, List<HGZL004> hgzl004List) {
List<String> inventCodes = hgzl002List.stream().map(HGZL002::getProductCode).collect(Collectors.toList());
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
hgzl002List.forEach(o->{
......@@ -201,8 +220,10 @@ public class HGKCTools {
hgkc003.setAccountCode(o.getAccountCode());
hgkc003.setDepCode(o.getDepCode());
if(Objects.nonNull(code)){
HGZL004 hgzl004 = hgzl004List.stream().filter(h->h.getCheckId().equals(o.getId())).findAny().orElse(null);
//整改通知单
hgkc003.setInvQty(new BigDecimal(o.getUnpassQuantity()));
hgkc003.setRectificationId(hgzl004.getId());
}else{
//工序质检单
hgkc003.setInvQty(new BigDecimal(o.getPassQuantity()));
......@@ -217,13 +238,16 @@ public class HGKCTools {
hgkc003.setProjName(o.getProjName());
hgkc003.setPartCode(o.getProductCode());
hgkc003.setPartName(o.getProductName());
hgkc003.setPartType(o.getProductType());
hgkc003.setPartType(hgpz005.getInventType());
hgkc003.setPartSpecId(hgpz005.getId());
hgkc003.setPartSpec(hgpz005.getSpec());
hgkc003.setPartCoefficient(hgpz005.getCoefficient());
hgkc003.setPartLength(hgpz005.getLength());
hgkc003.setPartWidth(hgpz005.getWidth());
hgkc003.setPartThick(hgpz005.getThick());
hgkc003.setDepositDate(DateUtils.shortDate());
hgkc003.setStorageType(HGConstant.StorageType.RK);
hgkc003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgkc003List.add(hgkc003);
}
});
......@@ -246,7 +270,7 @@ public class HGKCTools {
checkParamMap.put("ids", checkIds);
List<HGZL002> hgzl002List = DaoBase.getInstance().query(HGZL002.QUERY, checkParamMap);
//赋值
setHgkc003Data(hgzl002List,hgkc003List,CheckTypeEnum.PROCESS_CHECK.getCode());
setHgkc003Data(hgzl002List,hgkc003List,CheckTypeEnum.PROCESS_CHECK.getCode(),hgzl004List);
DaoUtils.insertBatch(HGKC003.INSERT,hgkc003List);
}
}
......
package com.baosight.hggp.hg.kc.utils;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGSqlConstant;
......@@ -14,9 +15,12 @@ import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -165,6 +169,7 @@ public class HGKCUtils {
// db数据
return HGKCTools.HgKc003.map(depositNos);
}
}
public static class HgKc006 {
......
package com.baosight.hggp.hg.sc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.hg.sb.domain.HGSB003;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.StringUtil;
......
......@@ -176,6 +176,13 @@
<isNotEmpty prepend=" AND " property="ids">
id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<!-- 移动端请求参数 -->
<isEqual prepend=" AND " property="completeStatus" compareValue="0">
ifnull(complete_date,'') = ''
</isEqual>
<isEqual prepend=" AND " property="completeStatus" compareValue="1">
ifnull(complete_date,'') != ''
</isEqual>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......
......@@ -2,10 +2,7 @@ package com.baosight.hggp.hg.sc.tools;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.copier.SrcToDestCopier;
import com.baosight.hggp.common.AssignStatusEnum;
import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.common.ComputeTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.common.*;
import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
......@@ -132,6 +129,60 @@ public class HGSCTools {
}
public static void complete(Long checkId, Integer completeNum, Long rectificationId){
HGZL002 hgzl002 = HGZLTools.THGZL002.get(checkId);
if(Objects.nonNull(rectificationId) && rectificationId.intValue() != 0){
//更新整改通知单状态,工序质检单与整改通知单是2条入库单数据
HGZL004 hgzl004 = HGZLTools.THGZL004.get(rectificationId);
hgzl004.setHandleStatus(HandleStatusEnum.UNPROCESS.getCode());
DaoUtils.update(HGZL004.UPDATE,hgzl004);
}else{
//整改通知单id为空的入库单才是工序质检单生成的入库单。
//更新工序质检单状态
hgzl002.setCheckStatus(CheckStatusEnum.CHECKING.getCode());
DaoUtils.update(HGZL002.UPDATE,hgzl002);
}
HGSC008 hgsc008 = THGSC008.getById(hgzl002.getWorkId());
HGSC007 hgsc007 = THGSC007.getById(hgsc008.getTaskId());
//更新生产任务完工数量
Integer finishQuatity = hgsc007.getFinishQuantity()+completeNum;
AssertUtils.isTrue(hgsc007.getQuantity().compareTo(finishQuatity)<0,"完工数量加已完工数量不能大于任务数量!");
AssertUtils.isTrue(finishQuatity<0,"扣除完工数量不能大于已完工数量!");
hgsc007.setFinishQuantity(finishQuatity);
hgsc007.setUnfinishQuantity(hgsc007.getQuantity() - finishQuatity);
hgsc007.setFinishWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(finishQuatity)));
hgsc007.setUnfinishWeight(hgsc007.getSingleWeight().multiply(new BigDecimal(hgsc007.getUnfinishQuantity())));
if(hgsc007.getUnfinishQuantity()==0){
hgsc007.setCompleteDate(DateUtil.toDateStr(new Date(),DateUtil.DATE10_PATTERN));
}
DaoUtils.update(HGSC007.UPDATE,hgsc007);
HGSC006A hgsc006A = THGSC006A.getById(hgsc007.getOrderDetailId());
HGSC005A hgsc005A = THGSC005A.getById(hgsc006A.getPlanDetailId());
finishQuatity = hgsc005A.getFinishQuantity()+completeNum;
AssertUtils.isTrue(hgsc005A.getQuantity().compareTo(finishQuatity)<0,"完工数量加已完工数量不能大于任务数量!");
AssertUtils.isTrue(finishQuatity<0,"扣除完工数量不能大于已完工数量!");
hgsc005A.setFinishQuantity(finishQuatity);
hgsc005A.setUnfinishQuantity(hgsc005A.getQuantity() - finishQuatity);
hgsc005A.setFinishWeight(hgsc005A.getSingleWeight().multiply(new BigDecimal(finishQuatity)));
hgsc005A.setUnfinishWeight(hgsc005A.getSingleWeight().multiply(new BigDecimal(hgsc007.getUnfinishQuantity())));
DaoUtils.update(HGSC005A.UPDATE,hgsc005A);
}
public static void hgkc003Delete(Long checkId, Integer completeNum, Long rectificationId){
HGZL002 hgzl002 = HGZLTools.THGZL002.get(checkId);
if(Objects.nonNull(rectificationId) && rectificationId.intValue() != 0){
//更新整改通知单状态,工序质检单与整改通知单是2条入库单数据
HGZL004 hgzl004 = HGZLTools.THGZL004.get(rectificationId);
hgzl004.setHandleStatus(HandleStatusEnum.UNPROCESS.getCode());
DaoUtils.update(HGZL004.UPDATE,hgzl004);
}else{
//整改通知单id为空的入库单才是工序质检单生成的入库单。
//更新工序质检单状态
hgzl002.setCheckStatus(CheckStatusEnum.CHECKING.getCode());
DaoUtils.update(HGZL002.UPDATE,hgzl002);
}
}
public static class Hgsc001 {
public static HGSC001 queryByCode(String code) {
AssertUtils.isNull(code, "项目Code不能为空!");
......@@ -324,6 +375,12 @@ public class HGSCTools {
public static class THGSC005A{
public static HGSC005A getById(Long id){
AssertUtils.isTrue(Objects.isNull(id)||id<=0, "计划明细ID不能为空!");
HGSC005A results = (HGSC005A)DaoBase.getInstance().get(HGSC005A.QUERY, HGSC005A.FIELD_id, id);
return results;
}
public static List<HGSC005A> queryByPlanCodes(List<String> planCodes){
AssertUtils.isEmpty(planCodes, "计划编码不能为空!");
Map paramMap = new HashMap();
......@@ -762,6 +819,12 @@ public class HGSCTools {
}
public static class THGSC008{
public static HGSC008 getById(Long taskId){
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "报工单ID不能为空!");
HGSC008 results = (HGSC008)DaoBase.getInstance().get(HGSC008.QUERY, HGSC008.FIELD_id, taskId);
return results;
}
public static List<HGSC008> getByTaskId(Long taskId){
AssertUtils.isTrue(Objects.isNull(taskId)||taskId<=0, "生产任务ID不能为空!");
List<HGSC008> results = DaoBase.getInstance().query(HGSC008.QUERY, new HashMap<String,Object>(){{put(HGSC008.FIELD_task_id, taskId);}});
......
......@@ -70,7 +70,6 @@ public class ServiceHGZL002 extends ServiceBase {
HGZLTools.THGZL004.addByHGZL002(o);
});
HGKCTools.HgKc003.putInStorageData(hgzl002List);
// putInStorage();
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgzl002List.size() + "]条数据保存成功!");
......
......@@ -7,18 +7,15 @@ import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.sc.domain.HGSC006A;
import com.baosight.hggp.hg.sc.domain.HGSC007;
import com.baosight.hggp.hg.sc.domain.HGSC008;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.hg.zl.domain.*;
import com.baosight.hggp.util.AssertUtils;
import com.baosight.iplat4j.core.data.DaoEPBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -90,6 +87,18 @@ public class HGZLTools {
public static class THGZL002 {
/**
* @param id
*/
public static HGZL002 get(Long id) {
AssertUtils.isNull(id, "ID不能为空");
Map paramMap = new HashMap();
paramMap.put(HGZL002.FIELD_id, id);
List<HGZL002> results = DaoBase.getInstance().query(HGZL002.QUERY, paramMap);
return CollectionUtils.isEmpty(results) ? null : results.get(0);
}
public static HGZL002 add(HGSC008 hgsc008) {
HGZL002 hgzl002 = new HGZL002();
BeanUtils.copyProperties(hgsc008, hgzl002);
......
let whNameGlobalData = [];
$(function () {
IPLATUI.EFGrid.result = {
......@@ -13,21 +15,66 @@ $(function () {
let status = item.submitStatus;
let template = '';
if (item.id){
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="showDetail(' + item.id +')" >详情</a>';
if (status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateSubmitStatus(' + item.id + ',1)" >提交</a>';
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="sendBack(' + item.id + ')" >退回</a>';
}
}
return template;
}
},
{
field: "whCode",
filter: function (options) {
return _.filter(whNameGlobalData, function (item) {
return item["param1Field"]=="true";
})
},
template: function (dataItem) {
for (let i = 0; i < whNameGlobalData.length; i++) {
if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) {
dataItem['whName'] = whNameGlobalData[i]['textField'];
return whNameGlobalData[i]['textField'];
}
}
return "";
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HGPZ007");
inInfo.set("methodName", "queryWhCodeBox");
inInfo.set("blockId", "wh_code_block_id");
inInfo.set("field", options.field);
refreshSelect(container, inInfo);
}
}
],
loadComplete: function (grid) {
// 此grid对象
grid.dataSource.bind("change", function(e) {
var item = e.items[0];
//仓库下拉框
if (e.field == "whCode") {
loadChange(grid,e,"price");
}
//金额计算
if (e.field == "price") {
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}
});
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'delete' ){
if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
......@@ -36,9 +83,6 @@ $(function () {
// 查询
$("#QUERY").on("click", query);
// 选择生产任务
$("#SELECT_TASK").on("click", selectTask);
});
/**
......@@ -46,6 +90,8 @@ $(function () {
*/
$(window).load(function () {
query();
// 仓库名称
initWh();
});
/**
......@@ -56,28 +102,20 @@ let query = function () {
}
/**
* 选择生产任务
* 初始化仓库
*/
let selectTask = function () {
JSColorbox.open({
href: "HGKC003A?methodName=initLoad",
title: "<div style='text-align: center;'>生产任务查询</div>",
width: "80%",
height: "80%",
callbackName: selectTaskCallback
});
let initWh = function () {
let inInfo = new EiInfo();
EiCommunicator.send("HGPZ007", "queryWhCodeBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_code_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 挑选库存回调
*/
let selectTaskCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 显示详情
*/
function showDetail(id) {
......@@ -111,3 +149,64 @@ function updateSubmitStatus(id,status) {
}
);
}
/**
* 保存
*/
let save = function () {
let rows = resultGrid.getCheckedRows();
if (rows.length < 1) {
message("请选择数据");
return;
}
let flag = true;
$.each(rows, function(index, item) {
let whCode= item.get("whCode");
let whName= item.get("whName");
let price= item.get("price");
if(isBlank(whCode)){
message("选中的第" + (index + 1) + "行\"仓库编码\",不能为空!");
flag = false;
return false;
}
if(isBlank(whName)){
message("选中的第" + (index + 1) + "行\"仓库名称\",不能为空!");
flag = false;
return false;
}
if(isBlank(price)){
message("选中的第" + (index + 1) + "行\"单价\",不能为空!");
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"保存\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HGKC003", "save", true);
}
});
}
}
/**
* 提交
* @param id
* @param status
*/
function sendBack(id) {
let inEiInfo = new EiInfo();
inEiInfo.set("result-0-id", id);
EiCommunicator.send('HGKC003', 'sendBack', inEiInfo, {
onSuccess(response) {
NotificationUtil(response.msg);
query();
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
}, {
async: false
}
);
}
......@@ -20,16 +20,52 @@
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row" readonly="true">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" width="140" enable="false" readonly="false"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" width="140" enable="false" readonly="false"/>
<EF:EFColumn ename="qualityId" cname="质检单id" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="rectificationId" cname="整改通知单ID" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="partSpecId" cname="零件规格ID" enable="false" width="90" align="center" hidden="true"/>
<EF:EFColumn ename="companyName" cname="公司名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projCode" cname="项目编号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="whCode" cname="仓库名称" width="120" align="center" required="true"/>
<EF:EFColumn ename="whName" cname="仓库名称" hidden="true"/>
<EF:EFColumn ename="depositDate" cname="单据日期" enable="false" width="100" align="center" editType="date"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="depositNo" cname="生产入库单号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="whName" cname="仓库名称" enable="false" width="120" align="center"/>
<EF:EFColumn ename="depositNoOld" cname="历史生产入库单号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="partType" cname="存货类型" width="120" align="center" required="false"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains" enable="false">
</EF:EFComboColumn>
<EF:EFColumn ename="partCode" 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="150" align="center"/>
<EF:EFColumn ename="partLength" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="partWidth" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="partThick" cname="厚(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="partCoefficient" cname="系数" enable="false" width="80" align="right" format="{0:N3}"/>
<EF:EFColumn ename="invQty" cname="数量" width="120" align="right" format="{0:N0}"
defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
required="false"
enable="false"/>
<EF:EFColumn ename="invUnitWeight" cname="单重" width="120" align="right" format="{0:N3}"
defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
enable="false"/>
<EF:EFColumn ename="invWeight" cname="总重" width="120" align="right" enable="false" format="{0:N3}"/>
<EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:N3}"
defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
required="true"/>
<EF:EFColumn ename="amount" cname="金额" width="120" align="right" enable="false" format="{0:N3}"/>
<EF:EFComboColumn cname="提交状态" ename="submitStatus" width="90" align="center" required="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" />
</EF:EFComboColumn>
......
......@@ -7,6 +7,7 @@ $(function () {
template: function (dataItem) {
for (let i = 0; i < whNameGlobalData.length; i++) {
if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) {
dataItem['whName'] = WhNameGlobalData[i]['textField'];
return whNameGlobalData[i]['textField'];
}
}
......@@ -14,11 +15,9 @@ $(function () {
},
editor: function (container, options) {
let inInfo = new EiInfo();
// 1.原料,2.耗材
inInfo.set("inqu_status-0-inventTypes", [3]);
inInfo.set("inqu_status-0-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ007");
inInfo.set("serviceName", "HGPZ007");
inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id");
inInfo.set("field", options.field);
......@@ -55,12 +54,9 @@ $(window).load(function () {
*/
let initWh = function () {
let inInfo = new EiInfo();
// 1.原料,2.耗材
inInfo.set("inqu_status-0-inventTypes", [3]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
EiCommunicator.send("HGPZ007", "queryWhCodeBox", inInfo, {
onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows();
WhNameGlobalData = ei.getBlock("wh_code_block_id").getMappedRows();
},
onFail: function (ei) {
}
......
let WhNameGlobalData = [];
$(function () {
var companyCodes = __eiInfo.getBlock("companyBox_block_id").getMappedRows();
IPLATUI.EFGrid.result = {
......
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