Commit 8cd3aec4 by 江和松

生产入库逻辑功能提交

parent cf5b21b5
...@@ -327,6 +327,21 @@ public class HGConstant { ...@@ -327,6 +327,21 @@ public class HGConstant {
// 退库 // 退库
public static final Integer TK = 2; 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 { ...@@ -128,6 +128,7 @@ public class HGKC003 extends DaoEPBase {
public static final String DELETE = "HGKC003.delete"; public static final String DELETE = "HGKC003.delete";
public static final String UPDATE_SUBMIT_STATUS = "HGKC003.updateSubmitStatus"; public static final String UPDATE_SUBMIT_STATUS = "HGKC003.updateSubmitStatus";
public static final String MAX_ID = "HGKC003.maxId"; public static final String MAX_ID = "HGKC003.maxId";
public static final String BATCH_DELETE = "HGKC003.batchDelete";
private Long id = new Long(0); private Long id = new Long(0);
private Long qualityId = new Long(0); /* 质检单id*/ private Long qualityId = new Long(0); /* 质检单id*/
...@@ -156,14 +157,14 @@ public class HGKC003 extends DaoEPBase { ...@@ -156,14 +157,14 @@ public class HGKC003 extends DaoEPBase {
private String prodTaskNo = " "; /* 生产任务号*/ private String prodTaskNo = " "; /* 生产任务号*/
private String projCode = " "; /* 项目编码*/ private String projCode = " "; /* 项目编码*/
private String projName = " "; /* 项目名称*/ private String projName = " "; /* 项目名称*/
private Integer prdtType; /* 产品类型*/ private String prdtType; /* 产品类型*/
private String prdtCode = " "; /* 产品编码*/ private String prdtCode = " "; /* 产品编码*/
private String prdtName = " "; /* 产品名称*/ private String prdtName = " "; /* 产品名称*/
private BigDecimal prdtLength = new BigDecimal(0.000); /* 产品-长*/ private BigDecimal prdtLength = new BigDecimal(0.000); /* 产品-长*/
private BigDecimal prdtWidth = new BigDecimal(0.000); /* 产品-宽*/ private BigDecimal prdtWidth = new BigDecimal(0.000); /* 产品-宽*/
private BigDecimal prdtThick = new BigDecimal(0.000); /* 产品-厚*/ private BigDecimal prdtThick = new BigDecimal(0.000); /* 产品-厚*/
private String prdtSpec = " "; /* 产品规格*/ private String prdtSpec = " "; /* 产品规格*/
private Integer partType; /* 零件类型*/ private String partType; /* 零件类型*/
private String partCode = " "; /* 零件编码*/ private String partCode = " "; /* 零件编码*/
private String partName = " "; /* 零件名称*/ private String partName = " "; /* 零件名称*/
private BigDecimal partLength = new BigDecimal(0.000); /* 零件-长*/ private BigDecimal partLength = new BigDecimal(0.000); /* 零件-长*/
...@@ -176,7 +177,7 @@ public class HGKC003 extends DaoEPBase { ...@@ -176,7 +177,7 @@ public class HGKC003 extends DaoEPBase {
private BigDecimal partCoefficient = new BigDecimal(0.000); /* 零件-系数*/ private BigDecimal partCoefficient = new BigDecimal(0.000); /* 零件-系数*/
private BigDecimal price = new BigDecimal("0"); /* 单价*/ private BigDecimal price = new BigDecimal("0"); /* 单价*/
private BigDecimal amount = new BigDecimal("0"); /* 金额*/ private BigDecimal amount = new BigDecimal("0"); /* 金额*/
private Boolean storageType; /* 入库类型:0:入库 1:退回*/ private Integer storageType; /* 入库类型:0:入库 1:退回*/
/** /**
* initialize the metadata. * initialize the metadata.
...@@ -843,7 +844,7 @@ public class HGKC003 extends DaoEPBase { ...@@ -843,7 +844,7 @@ public class HGKC003 extends DaoEPBase {
* get the prdtType - 产品类型. * get the prdtType - 产品类型.
* @return the prdtType * @return the prdtType
*/ */
public Integer getPrdtType() { public String getPrdtType() {
return this.prdtType; return this.prdtType;
} }
...@@ -852,7 +853,7 @@ public class HGKC003 extends DaoEPBase { ...@@ -852,7 +853,7 @@ public class HGKC003 extends DaoEPBase {
* *
* @param prdtType - 产品类型 * @param prdtType - 产品类型
*/ */
public void setPrdtType(Integer prdtType) { public void setPrdtType(String prdtType) {
this.prdtType = prdtType; this.prdtType = prdtType;
} }
/** /**
...@@ -955,7 +956,7 @@ public class HGKC003 extends DaoEPBase { ...@@ -955,7 +956,7 @@ public class HGKC003 extends DaoEPBase {
* get the partType - 零件类型. * get the partType - 零件类型.
* @return the partType * @return the partType
*/ */
public Integer getPartType() { public String getPartType() {
return this.partType; return this.partType;
} }
...@@ -964,7 +965,7 @@ public class HGKC003 extends DaoEPBase { ...@@ -964,7 +965,7 @@ public class HGKC003 extends DaoEPBase {
* *
* @param partType - 零件类型 * @param partType - 零件类型
*/ */
public void setPartType(Integer partType) { public void setPartType(String partType) {
this.partType = partType; this.partType = partType;
} }
/** /**
...@@ -1120,11 +1121,11 @@ public class HGKC003 extends DaoEPBase { ...@@ -1120,11 +1121,11 @@ public class HGKC003 extends DaoEPBase {
this.amount = amount; this.amount = amount;
} }
public Boolean getStorageType() { public Integer getStorageType() {
return storageType; return storageType;
} }
public void setStorageType(Boolean storageType) { public void setStorageType(Integer storageType) {
this.storageType = storageType; this.storageType = storageType;
} }
...@@ -1163,14 +1164,14 @@ public class HGKC003 extends DaoEPBase { ...@@ -1163,14 +1164,14 @@ public class HGKC003 extends DaoEPBase {
setProdTaskNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROD_TASK_NO)), prodTaskNo)); setProdTaskNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROD_TASK_NO)), prodTaskNo));
setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode)); setProjCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_CODE)), projCode));
setProjName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PROJ_NAME)), projName)); 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)); setPrdtCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_CODE)), prdtCode));
setPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_NAME)), prdtName)); setPrdtName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_NAME)), prdtName));
setPrdtLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_LENGTH)), prdtLength)); setPrdtLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_LENGTH)), prdtLength));
setPrdtWidth(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_WIDTH)), prdtWidth)); setPrdtWidth(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_WIDTH)), prdtWidth));
setPrdtThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_THICK)), prdtThick)); setPrdtThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRDT_THICK)), prdtThick));
setPrdtSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PRDT_SPEC)), prdtSpec)); 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)); setPartCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_CODE)), partCode));
setPartName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_NAME)), partName)); setPartName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_NAME)), partName));
setPartLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_LENGTH)), partLength)); setPartLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_LENGTH)), partLength));
...@@ -1183,7 +1184,7 @@ public class HGKC003 extends DaoEPBase { ...@@ -1183,7 +1184,7 @@ public class HGKC003 extends DaoEPBase {
setPartCoefficient(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_COEFFICIENT)), partCoefficient)); setPartCoefficient(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_COEFFICIENT)), partCoefficient));
setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price)); setPrice(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PRICE)), price));
setAmount(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_AMOUNT)), amount)); 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; ...@@ -6,7 +6,9 @@ import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC003; 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.kc.utils.HGKCUtils;
import com.baosight.hggp.hg.sc.tools.HGSCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -17,8 +19,10 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -17,8 +19,10 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author:songx * @author:songx
...@@ -36,9 +40,7 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -36,9 +40,7 @@ public class ServiceHGKC003 extends ServiceBase {
@OperationLogAnnotation(operModul = "生产入库单", operType = "查询", operDesc = "初始化") @OperationLogAnnotation(operModul = "生产入库单", operType = "查询", operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) { public EiInfo initLoad(EiInfo inInfo) {
try { try {
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID)); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_CODE_BLOCK_ID,DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BLOCK_ID));
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID));
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC003().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC003().eiMetadata);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -56,8 +58,7 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -56,8 +58,7 @@ public class ServiceHGKC003 extends ServiceBase {
@OperationLogAnnotation(operModul = "生产入库单", operType = "查询", operDesc = "查询") @OperationLogAnnotation(operModul = "生产入库单", operType = "查询", operDesc = "查询")
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
// Map queryRow = EiInfoUtils.getFirstRow(inInfo); CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_CODE_BLOCK_ID,DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID));
// HGKCUtils.HgKc003.setCondition(queryRow);
inInfo = super.query(inInfo, HGKC003.QUERY, new HGKC003()); inInfo = super.query(inInfo, HGKC003.QUERY, new HGKC003());
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
...@@ -66,6 +67,33 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -66,6 +67,33 @@ public class ServiceHGKC003 extends ServiceBase {
} }
/** /**
* 保存操作.
*
* @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++) {
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 * @param inInfo
...@@ -75,14 +103,15 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -75,14 +103,15 @@ public class ServiceHGKC003 extends ServiceBase {
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<HGKC003> fKc003s = MapUtils.toDaoEPBase(inInfo, HGKC003.class); List<HGKC003> fKc003s = MapUtils.toDaoEPBase(inInfo, HGKC003.class);
// 锁库存 // 生产入库单ids
Map<String, HGKC003> dbKc003Map = HGKCUtils.HgKc003.lockGetDataEp(fKc003s); List<Long> ids = fKc003s.stream().map(HGKC003::getId).collect(Collectors.toList());
// 锁生产计划明细 for(Long id : ids){
// HPSCTools.HpSc004.lock(prodOrderNos); HGKC003 hgkc003 = HGKCTools.HgKc003.getId(id);
// 校验数据 //修改计划生产任务完工数量
this.checkDeleteData(fKc003s, dbKc003Map); HGSCTools.complete(hgkc003.getQualityId(),hgkc003.getInvQty().negate().intValue(),hgkc003.getRectificationId());
// 查询数据 DaoUtils.update(HGKC003.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
this.deleteData(fKc003s, dbKc003Map); }
inInfo.setMsg("删除成功!"); inInfo.setMsg("删除成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败"); LogUtils.setDetailMsg(inInfo, e, "删除失败");
...@@ -91,16 +120,12 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -91,16 +120,12 @@ public class ServiceHGKC003 extends ServiceBase {
} }
/** /**
* @param fKc003s * @param fKc003
* @param dbKc003Map
*/ */
private void checkDeleteData(List<HGKC003> fKc003s, Map<String, HGKC003> dbKc003Map) { private void checkBackData(HGKC003 fKc003) {
for (HGKC003 fKc003 : fKc003s) { AssertUtils.isEquals(DeleteFlagEnum.REMOVE.getCode(), fKc003.getDeleteFlag(),
String depositNo = fKc003.getDepositNo(); String.format("入库单【%s】已删除,请勿重复操作", fKc003.getDepositNo()));
HGKC003 dbKc003 = dbKc003Map.get(depositNo); AssertUtils.isTrue(fKc003.getSubmitStatus().compareTo(HGConstant.ProductStatus.WTJ) == 0,"入库单"+fKc003.getDepositNo()+"未提交,请勿退回");
AssertUtils.isEquals(DeleteFlagEnum.REMOVE.getCode(), dbKc003.getDeleteFlag(),
String.format("入库单【%s】已删除,请勿重复操作", depositNo));
}
} }
...@@ -117,7 +142,16 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -117,7 +142,16 @@ public class ServiceHGKC003 extends ServiceBase {
for (i = 0; i < eiBlock.getRowCount(); i++) { for (i = 0; i < eiBlock.getRowCount(); i++) {
Map<?, ?> map = eiBlock.getRow(i); Map<?, ?> map = eiBlock.getRow(i);
hgkc003.fromMap(map); hgkc003.fromMap(map);
hgkc003 = HGKCTools.HgKc003.getId(hgkc003.getId());
// 校验数据
this.checkSubmitData(hgkc003);
DaoUtils.update(HGKC003.UPDATE_SUBMIT_STATUS, 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.setStatus(EiConstant.STATUS_SUCCESS);
inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "提交")}); inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "提交")});
...@@ -132,33 +166,62 @@ public class ServiceHGKC003 extends ServiceBase { ...@@ -132,33 +166,62 @@ public class ServiceHGKC003 extends ServiceBase {
return inInfo; return inInfo;
} }
private void checkSubmitData(HGKC003 hgkc003) {
AssertUtils.isEmpty(hgkc003.getWhCode(),"仓库编码不能为空!");
AssertUtils.isEmpty(hgkc003.getWhName(),"仓库名称不能为空!");
AssertUtils.isNull(hgkc003.getPrice(),"单价不能为空!");
}
/** /**
* 删除数据 * 退回操作
* * @param inInfo
* @param fKc003s * @return
* @param dbKc003Map
*/ */
private void deleteData(List<HGKC003> fKc003s, Map<String, HGKC003> dbKc003Map) { public EiInfo sendBack(EiInfo inInfo){
for (HGKC003 fKc003 : fKc003s) { int i = 0;
fKc003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); try {
DaoUtils.update(HGKC003.DELETE, fKc003); HGKC003 hgkc003 = new HGKC003();
// 生产一条负数量和产量的红冲记录 EiBlock eiBlock = inInfo.getBlock(EiConstant.resultBlock);
HGKC003 dbKc003 = dbKc003Map.get(fKc003.getDepositNo()); for (i = 0; i < eiBlock.getRowCount(); i++) {
HGKC003 newKc003 = BeanUtils.copy(dbKc003, HGKC003.class); Map<?, ?> map = eiBlock.getRow(i);
newKc003.setInvQty(dbKc003.getInvQty().negate()); hgkc003.fromMap(map);
newKc003.setInvWeight(dbKc003.getInvWeight().negate()); hgkc003 = HGKCTools.HgKc003.getId(hgkc003.getId());
newKc003.setDeleteFlag(DeleteFlagEnum.REMOVE.getCode()); // 校验数据
newKc003.setDepositNoOld(fKc003.getDepositNo()); this.checkBackData(hgkc003);
newKc003.setDepositNo(SequenceGenerator.getNextSequence(HGConstant.SequenceId.PROD_DEPOSIT_NO)); // 退回数据
DaoUtils.insert(HGKC003.INSERT, newKc003); this.sendBackOption(hgkc003);
// 同步生产计划 }
// HPSCTools.syncPlan(newKc003.getProdOrderNo(), newKc003.getAmount()); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
// 更新生产任务已完成数量 inInfo.setMsgByKey("ep.1000", new String[]{String.valueOf(i), I18nMessages.getText("label.update", "退回")});
// HPSCTools.HpSc005a.updateCompleteNum(newKc003.getProdTaskNo(), newKc003.getAmount()); } catch (PlatException e) {
// 修改库存 e.printStackTrace();
HGKCUtils.HgKc011.updateInv(newKc003.getCompanyCode(), newKc003.getWhCode(), newKc003.getProdOrderNo(), inInfo.setStatus(EiConstant.STATUS_FAILURE);
newKc003.getInvQty(), newKc003.getInvWeight()); ErrorCodeUtils.handleUpdateException(inInfo,i,e);
logError("修改失败", e.getMessage());
return inInfo;
} }
return inInfo;
}
/**
* 退回数据
*
* @param fKc003
*/
private void sendBackOption(HGKC003 fKc003) {
// 生产一条负数量和产量的红冲记录
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);
// 修改库存
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 @@ ...@@ -200,7 +200,7 @@
AMOUNT as "amount", <!-- 金额 --> AMOUNT as "amount", <!-- 金额 -->
STORAGE_TYPE as "storageType", <!-- 入库类型:0:入库 1:退回 --> STORAGE_TYPE as "storageType", <!-- 入库类型:0:入库 1:退回 -->
SUBMIT_STATUS as "submitStatus" <!-- 提交状态 --> SUBMIT_STATUS as "submitStatus" <!-- 提交状态 -->
FROM ${hggpSchema}.HGKC003 WHERE 1=1 FROM ${hggpSchema}.HGKC003 WHERE 1=1 AND DELETE_FLAG = 0
<include refid="condition" /> <include refid="condition" />
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
...@@ -281,12 +281,11 @@ ...@@ -281,12 +281,11 @@
</insert> </insert>
<delete id="delete"> <delete id="delete">
DELETE FROM ${hggpSchema}.HGKC003 WHERE UPDATE ${hggpSchema}.HGKC003 SET DELETE_FLAG = 1 WHERE ID = #id#
ID = #id#
</delete> </delete>
<delete id="batchDelete"> <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> id IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</delete> </delete>
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baosight.hggp.common.CheckTypeEnum; import com.baosight.hggp.common.CheckTypeEnum;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; 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.HGConstant;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
import com.baosight.hggp.hg.kc.domain.*; import com.baosight.hggp.hg.kc.domain.*;
...@@ -12,6 +13,7 @@ import com.baosight.hggp.hg.pz.tools.HGPZTools; ...@@ -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.HGZL002;
import com.baosight.hggp.hg.zl.domain.HGZL004; import com.baosight.hggp.hg.zl.domain.HGZL004;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -133,6 +135,22 @@ public class HGKCTools { ...@@ -133,6 +135,22 @@ public class HGKCTools {
*/ */
public static class HgKc003 { 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){ public static HGKC003 save(HGKC003 hgkc003,List<HGKC003A> hgkc003aList){
checkSaveData(hgkc003,hgkc003aList); checkSaveData(hgkc003,hgkc003aList);
...@@ -178,15 +196,16 @@ public class HGKCTools { ...@@ -178,15 +196,16 @@ public class HGKCTools {
*/ */
public static void putInStorageData(List<HGZL002> hgzl002List) { public static void putInStorageData(List<HGZL002> hgzl002List) {
List<HGKC003> hgkc003List = new LinkedList<>(); List<HGKC003> hgkc003List = new LinkedList<>();
setHgkc003Data(hgzl002List,hgkc003List, null); setHgkc003Data(hgzl002List,hgkc003List, null, null);
DaoUtils.insertBatch(HGKC003.INSERT,hgkc003List); DaoUtils.insertBatch(HGKC003.INSERT,hgkc003List);
} }
/** /**
* 对象赋值(工序质检单) * 对象赋值(工序质检单)
* @param hgzl002List * @param hgzl002List
* @param code * @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<String> inventCodes = hgzl002List.stream().map(HGZL002::getProductCode).collect(Collectors.toList());
List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes); List<HGPZ005> hgpz005List = HGPZTools.HgPz005.listByInventCodes(inventCodes);
hgzl002List.forEach(o->{ hgzl002List.forEach(o->{
...@@ -201,8 +220,10 @@ public class HGKCTools { ...@@ -201,8 +220,10 @@ public class HGKCTools {
hgkc003.setAccountCode(o.getAccountCode()); hgkc003.setAccountCode(o.getAccountCode());
hgkc003.setDepCode(o.getDepCode()); hgkc003.setDepCode(o.getDepCode());
if(Objects.nonNull(code)){ 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.setInvQty(new BigDecimal(o.getUnpassQuantity()));
hgkc003.setRectificationId(hgzl004.getId());
}else{ }else{
//工序质检单 //工序质检单
hgkc003.setInvQty(new BigDecimal(o.getPassQuantity())); hgkc003.setInvQty(new BigDecimal(o.getPassQuantity()));
...@@ -217,13 +238,16 @@ public class HGKCTools { ...@@ -217,13 +238,16 @@ public class HGKCTools {
hgkc003.setProjName(o.getProjName()); hgkc003.setProjName(o.getProjName());
hgkc003.setPartCode(o.getProductCode()); hgkc003.setPartCode(o.getProductCode());
hgkc003.setPartName(o.getProductName()); hgkc003.setPartName(o.getProductName());
hgkc003.setPartType(o.getProductType()); hgkc003.setPartType(hgpz005.getInventType());
hgkc003.setPartSpecId(hgpz005.getId()); hgkc003.setPartSpecId(hgpz005.getId());
hgkc003.setPartSpec(hgpz005.getSpec()); hgkc003.setPartSpec(hgpz005.getSpec());
hgkc003.setPartCoefficient(hgpz005.getCoefficient()); hgkc003.setPartCoefficient(hgpz005.getCoefficient());
hgkc003.setPartLength(hgpz005.getLength()); hgkc003.setPartLength(hgpz005.getLength());
hgkc003.setPartWidth(hgpz005.getWidth()); hgkc003.setPartWidth(hgpz005.getWidth());
hgkc003.setPartThick(hgpz005.getThick()); hgkc003.setPartThick(hgpz005.getThick());
hgkc003.setDepositDate(DateUtils.shortDate());
hgkc003.setStorageType(HGConstant.StorageType.RK);
hgkc003.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
hgkc003List.add(hgkc003); hgkc003List.add(hgkc003);
} }
}); });
...@@ -246,7 +270,7 @@ public class HGKCTools { ...@@ -246,7 +270,7 @@ public class HGKCTools {
checkParamMap.put("ids", checkIds); checkParamMap.put("ids", checkIds);
List<HGZL002> hgzl002List = DaoBase.getInstance().query(HGZL002.QUERY, checkParamMap); 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); DaoUtils.insertBatch(HGKC003.INSERT,hgkc003List);
} }
} }
......
package com.baosight.hggp.hg.kc.utils; 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.dao.DaoUtils;
import com.baosight.hggp.core.enums.DeleteFlagEnum; import com.baosight.hggp.core.enums.DeleteFlagEnum;
import com.baosight.hggp.hg.constant.HGSqlConstant; import com.baosight.hggp.hg.constant.HGSqlConstant;
...@@ -14,9 +15,12 @@ import com.baosight.hggp.util.DateUtils; ...@@ -14,9 +15,12 @@ import com.baosight.hggp.util.DateUtils;
import com.baosight.hggp.util.MapUtils; import com.baosight.hggp.util.MapUtils;
import com.baosight.hggp.util.ObjectUtils; import com.baosight.hggp.util.ObjectUtils;
import com.baosight.hggp.util.StringUtils; import com.baosight.hggp.util.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.Collections;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -25,7 +29,7 @@ import java.util.Map; ...@@ -25,7 +29,7 @@ import java.util.Map;
* @date:2024/5/13,14:57 * @date:2024/5/13,14:57
*/ */
public class HGKCUtils { public class HGKCUtils {
/** /**
* HGKC001 工具类 * HGKC001 工具类
* *
...@@ -33,7 +37,7 @@ public class HGKCUtils { ...@@ -33,7 +37,7 @@ public class HGKCUtils {
* @date:2024/5/9,16:58 * @date:2024/5/9,16:58
*/ */
public static class HgKc001 { public static class HgKc001 {
/** /**
* 设置查询条件 * 设置查询条件
* *
...@@ -48,7 +52,7 @@ public class HGKCUtils { ...@@ -48,7 +52,7 @@ public class HGKCUtils {
queryRow.put(HGKC001.FIELD_DEPOSIT_DATE, DateUtils.formatShort(depositDate)); queryRow.put(HGKC001.FIELD_DEPOSIT_DATE, DateUtils.formatShort(depositDate));
} }
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -58,7 +62,7 @@ public class HGKCUtils { ...@@ -58,7 +62,7 @@ public class HGKCUtils {
public static Map<String, HGKC001> lockGetDataEp(List<? extends HGKC001> kc001s) { public static Map<String, HGKC001> lockGetDataEp(List<? extends HGKC001> kc001s) {
return lockGetData(ObjectUtils.listEpKey(kc001s, HGKC001.FIELD_DEPOSIT_NO)); return lockGetData(ObjectUtils.listEpKey(kc001s, HGKC001.FIELD_DEPOSIT_NO));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -72,7 +76,7 @@ public class HGKCUtils { ...@@ -72,7 +76,7 @@ public class HGKCUtils {
return HGKCTools.HgKc001.map(depositNos); return HGKCTools.HgKc001.map(depositNos);
} }
} }
/** /**
* HGKC002 工具类 * HGKC002 工具类
* *
...@@ -80,7 +84,7 @@ public class HGKCUtils { ...@@ -80,7 +84,7 @@ public class HGKCUtils {
* @date:2024/5/9,16:58 * @date:2024/5/9,16:58
*/ */
public static class HgKc002 { public static class HgKc002 {
/** /**
* 设置查询条件 * 设置查询条件
* *
...@@ -95,7 +99,7 @@ public class HGKCUtils { ...@@ -95,7 +99,7 @@ public class HGKCUtils {
queryRow.put(HGKC002.FIELD_RECEIPT_DATE, DateUtils.formatShort(receiptDate)); queryRow.put(HGKC002.FIELD_RECEIPT_DATE, DateUtils.formatShort(receiptDate));
} }
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -105,7 +109,7 @@ public class HGKCUtils { ...@@ -105,7 +109,7 @@ public class HGKCUtils {
public static Map<String, HGKC002> lockGetDataEp(List<? extends HGKC002> kc002s) { public static Map<String, HGKC002> lockGetDataEp(List<? extends HGKC002> kc002s) {
return lockGetData(ObjectUtils.listEpKey(kc002s, HGKC002.FIELD_REQ_NO)); return lockGetData(ObjectUtils.listEpKey(kc002s, HGKC002.FIELD_REQ_NO));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -119,7 +123,7 @@ public class HGKCUtils { ...@@ -119,7 +123,7 @@ public class HGKCUtils {
return HGKCTools.HgKc002.map(reqNos); return HGKCTools.HgKc002.map(reqNos);
} }
} }
/** /**
* HGKC003 工具类 * HGKC003 工具类
* *
...@@ -127,7 +131,7 @@ public class HGKCUtils { ...@@ -127,7 +131,7 @@ public class HGKCUtils {
* @date:2024/5/9,16:58 * @date:2024/5/9,16:58
*/ */
public static class HgKc003 { public static class HgKc003 {
/** /**
* 设置查询条件 * 设置查询条件
* *
...@@ -142,7 +146,7 @@ public class HGKCUtils { ...@@ -142,7 +146,7 @@ public class HGKCUtils {
queryRow.put(HGKC003.FIELD_DEPOSIT_DATE, DateUtils.formatShort(depositDate)); queryRow.put(HGKC003.FIELD_DEPOSIT_DATE, DateUtils.formatShort(depositDate));
} }
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -152,7 +156,7 @@ public class HGKCUtils { ...@@ -152,7 +156,7 @@ public class HGKCUtils {
public static Map<String, HGKC003> lockGetDataEp(List<? extends HGKC003> kc003s) { public static Map<String, HGKC003> lockGetDataEp(List<? extends HGKC003> kc003s) {
return lockGetData(ObjectUtils.listEpKey(kc003s, HGKC003.FIELD_DEPOSIT_NO)); return lockGetData(ObjectUtils.listEpKey(kc003s, HGKC003.FIELD_DEPOSIT_NO));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -165,6 +169,7 @@ public class HGKCUtils { ...@@ -165,6 +169,7 @@ public class HGKCUtils {
// db数据 // db数据
return HGKCTools.HgKc003.map(depositNos); return HGKCTools.HgKc003.map(depositNos);
} }
} }
public static class HgKc006 { public static class HgKc006 {
...@@ -207,7 +212,7 @@ public class HGKCUtils { ...@@ -207,7 +212,7 @@ public class HGKCUtils {
* @date:2024/5/9,16:58 * @date:2024/5/9,16:58
*/ */
public static class HgKc010 { public static class HgKc010 {
/** /**
* 更新库存 * 更新库存
* *
...@@ -221,7 +226,7 @@ public class HGKCUtils { ...@@ -221,7 +226,7 @@ public class HGKCUtils {
BigDecimal weight) { BigDecimal weight) {
updateInv(companyCode, whCode, specId, qty, null, weight); updateInv(companyCode, whCode, specId, qty, null, weight);
} }
/** /**
* 更新库存 * 更新库存
* *
...@@ -247,7 +252,7 @@ public class HGKCUtils { ...@@ -247,7 +252,7 @@ public class HGKCUtils {
updateInvData(newKc010, dbKc010); updateInvData(newKc010, dbKc010);
} }
} }
/** /**
* 构建对象 * 构建对象
* *
...@@ -270,7 +275,7 @@ public class HGKCUtils { ...@@ -270,7 +275,7 @@ public class HGKCUtils {
newKc010.setInvWeight(weight); newKc010.setInvWeight(weight);
return newKc010; return newKc010;
} }
/** /**
* 参数校验 * 参数校验
* *
...@@ -290,7 +295,7 @@ public class HGKCUtils { ...@@ -290,7 +295,7 @@ public class HGKCUtils {
AssertUtils.isTrue(qty.compareTo(BigDecimal.ZERO) == 0 AssertUtils.isTrue(qty.compareTo(BigDecimal.ZERO) == 0
&& weight.compareTo(BigDecimal.ZERO) == 0, "库存变更数量和重量不能为空"); && weight.compareTo(BigDecimal.ZERO) == 0, "库存变更数量和重量不能为空");
} }
/** /**
* 新增库存 * 新增库存
* *
...@@ -315,7 +320,7 @@ public class HGKCUtils { ...@@ -315,7 +320,7 @@ public class HGKCUtils {
newKc010.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newKc010.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGKC010.INSERT, newKc010); DaoUtils.insert(HGKC010.INSERT, newKc010);
} }
/** /**
* 修改库存 * 修改库存
* *
...@@ -333,7 +338,7 @@ public class HGKCUtils { ...@@ -333,7 +338,7 @@ public class HGKCUtils {
dbKc010.setInvUnitWeight(newUnitWeight); dbKc010.setInvUnitWeight(newUnitWeight);
DaoUtils.update(HGSqlConstant.HgKc010.UPDATE_INV, dbKc010); DaoUtils.update(HGSqlConstant.HgKc010.UPDATE_INV, dbKc010);
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -343,7 +348,7 @@ public class HGKCUtils { ...@@ -343,7 +348,7 @@ public class HGKCUtils {
public static Map<Long, HGKC010> lockGetDataEp(List<? extends HGKC010> kc010s) { public static Map<Long, HGKC010> lockGetDataEp(List<? extends HGKC010> kc010s) {
return lockGetData(ObjectUtils.listEpKey(kc010s, HGKC010.FIELD_ID)); return lockGetData(ObjectUtils.listEpKey(kc010s, HGKC010.FIELD_ID));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -356,9 +361,9 @@ public class HGKCUtils { ...@@ -356,9 +361,9 @@ public class HGKCUtils {
// db数据 // db数据
return HGKCTools.HgKc010.map(ids); return HGKCTools.HgKc010.map(ids);
} }
} }
/** /**
* HGKC011 工具类 * HGKC011 工具类
* *
...@@ -366,7 +371,7 @@ public class HGKCUtils { ...@@ -366,7 +371,7 @@ public class HGKCUtils {
* @date:2024/5/9,16:58 * @date:2024/5/9,16:58
*/ */
public static class HgKc011 { public static class HgKc011 {
/** /**
* 更新库存 * 更新库存
* *
...@@ -380,7 +385,7 @@ public class HGKCUtils { ...@@ -380,7 +385,7 @@ public class HGKCUtils {
BigDecimal weight) { BigDecimal weight) {
updateInv(companyCode, whCode, prodOrderNo, qty, null, weight); updateInv(companyCode, whCode, prodOrderNo, qty, null, weight);
} }
/** /**
* 更新库存 * 更新库存
* *
...@@ -406,7 +411,7 @@ public class HGKCUtils { ...@@ -406,7 +411,7 @@ public class HGKCUtils {
updateInvData(newKc011, dbKc011); updateInvData(newKc011, dbKc011);
} }
} }
/** /**
* 构建对象 * 构建对象
* *
...@@ -429,7 +434,7 @@ public class HGKCUtils { ...@@ -429,7 +434,7 @@ public class HGKCUtils {
newKc011.setInvWeight(weight); newKc011.setInvWeight(weight);
return newKc011; return newKc011;
} }
/** /**
* 参数校验 * 参数校验
* *
...@@ -449,7 +454,7 @@ public class HGKCUtils { ...@@ -449,7 +454,7 @@ public class HGKCUtils {
AssertUtils.isTrue(qty.compareTo(BigDecimal.ZERO) == 0 AssertUtils.isTrue(qty.compareTo(BigDecimal.ZERO) == 0
&& weight.compareTo(BigDecimal.ZERO) == 0, "库存变更数量和重量不能为0"); && weight.compareTo(BigDecimal.ZERO) == 0, "库存变更数量和重量不能为0");
} }
/** /**
* 新增库存 * 新增库存
* *
...@@ -472,7 +477,7 @@ public class HGKCUtils { ...@@ -472,7 +477,7 @@ public class HGKCUtils {
newKc011.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode()); newKc011.setDeleteFlag(DeleteFlagEnum.UN_REMOVE.getCode());
DaoUtils.insert(HGKC011.INSERT, newKc011); DaoUtils.insert(HGKC011.INSERT, newKc011);
} }
/** /**
* 修改库存 * 修改库存
* *
...@@ -491,7 +496,7 @@ public class HGKCUtils { ...@@ -491,7 +496,7 @@ public class HGKCUtils {
dbKc011.setInvUnitWeight(newUnitWeight); dbKc011.setInvUnitWeight(newUnitWeight);
DaoUtils.update(HGSqlConstant.HgKc011.UPDATE_INV, dbKc011); DaoUtils.update(HGSqlConstant.HgKc011.UPDATE_INV, dbKc011);
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -501,7 +506,7 @@ public class HGKCUtils { ...@@ -501,7 +506,7 @@ public class HGKCUtils {
public static Map<Long, HGKC010> lockGetDataEp(List<? extends HGKC010> kc010s) { public static Map<Long, HGKC010> lockGetDataEp(List<? extends HGKC010> kc010s) {
return lockGetData(ObjectUtils.listEpKey(kc010s, HGKC010.FIELD_ID)); return lockGetData(ObjectUtils.listEpKey(kc010s, HGKC010.FIELD_ID));
} }
/** /**
* 锁并且获取数据 * 锁并且获取数据
* *
...@@ -514,6 +519,6 @@ public class HGKCUtils { ...@@ -514,6 +519,6 @@ public class HGKCUtils {
// db数据 // db数据
return HGKCTools.HgKc010.map(ids); return HGKCTools.HgKc010.map(ids);
} }
} }
} }
...@@ -2,10 +2,7 @@ package com.baosight.hggp.hg.sc.tools; ...@@ -2,10 +2,7 @@ package com.baosight.hggp.hg.sc.tools;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.copier.SrcToDestCopier; import cn.hutool.core.lang.copier.SrcToDestCopier;
import com.baosight.hggp.common.AssignStatusEnum; import com.baosight.hggp.common.*;
import com.baosight.hggp.common.CheckStatusEnum;
import com.baosight.hggp.common.ComputeTypeEnum;
import com.baosight.hggp.common.ProductTypeEnum;
import com.baosight.hggp.core.constant.CommonConstant; import com.baosight.hggp.core.constant.CommonConstant;
import com.baosight.hggp.core.dao.DaoBase; import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
...@@ -132,8 +129,19 @@ public class HGSCTools { ...@@ -132,8 +129,19 @@ public class HGSCTools {
} }
public static void complete(Long checkId, Integer completeNum){ public static void complete(Long checkId, Integer completeNum, Long rectificationId){
HGZL002 hgzl002 = HGZLTools.THGZL002.get(checkId); 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()); HGSC008 hgsc008 = THGSC008.getById(hgzl002.getWorkId());
HGSC007 hgsc007 = THGSC007.getById(hgsc008.getTaskId()); HGSC007 hgsc007 = THGSC007.getById(hgsc008.getTaskId());
//更新生产任务完工数量 //更新生产任务完工数量
......
...@@ -70,7 +70,6 @@ public class ServiceHGZL002 extends ServiceBase { ...@@ -70,7 +70,6 @@ public class ServiceHGZL002 extends ServiceBase {
HGZLTools.THGZL004.addByHGZL002(o); HGZLTools.THGZL004.addByHGZL002(o);
}); });
HGKCTools.HgKc003.putInStorageData(hgzl002List); HGKCTools.HgKc003.putInStorageData(hgzl002List);
// putInStorage();
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + hgzl002List.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + hgzl002List.size() + "]条数据保存成功!");
......
let whNameGlobalData = [];
$(function () { $(function () {
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
...@@ -13,21 +15,66 @@ $(function () { ...@@ -13,21 +15,66 @@ $(function () {
let status = item.submitStatus; let status = item.submitStatus;
let template = ''; let template = '';
if (item.id){ 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) { if (status == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'onclick="updateSubmitStatus(' + item.id + ',1)" >提交</a>'; + '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; 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) { 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) { onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'delete' ){ if(e.eiInfo.extAttr.methodName == 'save'
||e.eiInfo.extAttr.methodName == 'delete' ){
query(); query();
} }
} }
...@@ -36,9 +83,6 @@ $(function () { ...@@ -36,9 +83,6 @@ $(function () {
// 查询 // 查询
$("#QUERY").on("click", query); $("#QUERY").on("click", query);
// 选择生产任务
$("#SELECT_TASK").on("click", selectTask);
}); });
/** /**
...@@ -46,6 +90,8 @@ $(function () { ...@@ -46,6 +90,8 @@ $(function () {
*/ */
$(window).load(function () { $(window).load(function () {
query(); query();
// 仓库名称
initWh();
}); });
/** /**
...@@ -56,28 +102,20 @@ let query = function () { ...@@ -56,28 +102,20 @@ let query = function () {
} }
/** /**
* 选择生产任务 * 初始化仓库
*/ */
let selectTask = function () { let initWh = function () {
JSColorbox.open({ let inInfo = new EiInfo();
href: "HGKC003A?methodName=initLoad", EiCommunicator.send("HGPZ007", "queryWhCodeBox", inInfo, {
title: "<div style='text-align: center;'>生产任务查询</div>", onSuccess: function (ei) {
width: "80%", whNameGlobalData = ei.getBlock("wh_code_block_id").getMappedRows();
height: "80%", },
callbackName: selectTaskCallback onFail: function (ei) {
}); }
}, {async: false});
} }
/** /**
* 挑选库存回调
*/
let selectTaskCallback = function () {
// 刷新页面
query();
// 关闭弹窗
JSColorbox.close();
}
/**
* 显示详情 * 显示详情
*/ */
function showDetail(id) { function showDetail(id) {
...@@ -111,3 +149,64 @@ function updateSubmitStatus(id,status) { ...@@ -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 @@ ...@@ -20,16 +20,52 @@
</EF:EFRegion> </EF:EFRegion>
<EF:EFRegion id="result" title="明细信息"> <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="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="companyName" cname="公司名称" enable="false" width="140" align="center"/>
<EF:EFColumn ename="projCode" 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="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" <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="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:EFComboColumn cname="提交状态" ename="submitStatus" width="90" align="center" required="false">
<EF:EFCodeOption codeName="hggp.sc.productStatus" /> <EF:EFCodeOption codeName="hggp.sc.productStatus" />
</EF:EFComboColumn> </EF:EFComboColumn>
......
...@@ -7,6 +7,7 @@ $(function () { ...@@ -7,6 +7,7 @@ $(function () {
template: function (dataItem) { template: function (dataItem) {
for (let i = 0; i < whNameGlobalData.length; i++) { for (let i = 0; i < whNameGlobalData.length; i++) {
if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) { if (whNameGlobalData[i]['valueField'] === dataItem['whCode']) {
dataItem['whName'] = WhNameGlobalData[i]['textField'];
return whNameGlobalData[i]['textField']; return whNameGlobalData[i]['textField'];
} }
} }
...@@ -14,11 +15,9 @@ $(function () { ...@@ -14,11 +15,9 @@ $(function () {
}, },
editor: function (container, options) { editor: function (container, options) {
let inInfo = new EiInfo(); 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-whType", options.model["inventType"]);
inInfo.set("inqu_status-0-isSplicingSymbol", false); inInfo.set("inqu_status-0-isSplicingSymbol", false);
inInfo.set("serviceName", "HPPZ007"); inInfo.set("serviceName", "HGPZ007");
inInfo.set("methodName", "queryComboBox"); inInfo.set("methodName", "queryComboBox");
inInfo.set("blockId", "wh_record_block_id"); inInfo.set("blockId", "wh_record_block_id");
inInfo.set("field", options.field); inInfo.set("field", options.field);
...@@ -55,12 +54,9 @@ $(window).load(function () { ...@@ -55,12 +54,9 @@ $(window).load(function () {
*/ */
let initWh = function () { let initWh = function () {
let inInfo = new EiInfo(); let inInfo = new EiInfo();
// 1.原料,2.耗材 EiCommunicator.send("HGPZ007", "queryWhCodeBox", inInfo, {
inInfo.set("inqu_status-0-inventTypes", [3]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HPPZ007", "queryComboBox", inInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
whNameGlobalData = ei.getBlock("wh_record_block_id").getMappedRows(); WhNameGlobalData = ei.getBlock("wh_code_block_id").getMappedRows();
}, },
onFail: function (ei) { onFail: function (ei) {
} }
......
let WhNameGlobalData = [];
$(function () { $(function () {
var companyCodes = __eiInfo.getBlock("companyBox_block_id").getMappedRows(); var companyCodes = __eiInfo.getBlock("companyBox_block_id").getMappedRows();
IPLATUI.EFGrid.result = { 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