Commit fdca1196 by 江和松

生产领料功能提交

parent 0e5411cf
......@@ -275,4 +275,20 @@ public class HGConstant {
public static final Integer SC = 3;
}
/**
*
* 领料单类型
* @author:jianghesong
* @date:2024/5/15,15:18
*/
public static class ReceiveType {
// 默认
public static final Integer DEFAULT = 0;
// 正常
public static final Integer ZC = 1;
// 退库
public static final Integer TK = 2;
}
}
......@@ -71,6 +71,7 @@ public class HGKC008 extends DaoEPBase {
public static final String DELETE = "HGKC008.delete";
public static final String BATCH_DELETE = "HGKC008.batchDelete";;
public static final String UPDATE_STATUS = "HGKC008.updateStatus";;
public static final String UPDATE_RECEIVE_TYPE = "HGKC008.updateReceiveType";;
private Long id = new Long(0); /* 主键id*/
private String accountCode = " "; /* 账套*/
......
......@@ -41,6 +41,7 @@ public class HGKC008A extends DaoEPBase {
public static final String FIELD_INVENT_TYPE = "inventType"; /* 存货类型*/
public static final String FIELD_INVENT_CODE = "inventCode"; /* 存货编码*/
public static final String FIELD_INVENT_NAME = "inventName"; /* 存货名称*/
public static final String FIELD_INV_SPEC_ID = "invSpecId"; /* 规格*/
public static final String FIELD_INV_SPEC = "invSpec"; /* 规格*/
public static final String FIELD_INV_LENGTH = "invLength"; /* 长度(MM)*/
public static final String FIELD_INV_WIDTH = "invWidth"; /* 宽度(MM)*/
......@@ -72,6 +73,7 @@ public class HGKC008A extends DaoEPBase {
public static final String COL_INVENT_TYPE = "INVENT_TYPE"; /* 存货类型*/
public static final String COL_INVENT_CODE = "INVENT_CODE"; /* 存货编码*/
public static final String COL_INVENT_NAME = "INVENT_NAME"; /* 存货名称*/
public static final String COL_INV_SPEC_ID = "invSpecId"; /* 规格Id*/
public static final String COL_INV_SPEC = "INV_SPEC"; /* 规格*/
public static final String COL_INV_LENGTH = "INV_LENGTH"; /* 长度(MM)*/
public static final String COL_INV_WIDTH = "INV_WIDTH"; /* 宽度(MM)*/
......@@ -110,6 +112,7 @@ public class HGKC008A extends DaoEPBase {
private String inventType = " "; /* 存货类型*/
private String inventCode = " "; /* 存货编码*/
private String inventName = " "; /* 存货名称*/
private Long invSpecId = new Long(0); /* 规格id*/
private String invSpec = " "; /* 规格*/
private BigDecimal invLength = new BigDecimal(0.000); /* 长度(MM)*/
private BigDecimal invWidth = new BigDecimal(0.000); /* 宽度(MM)*/
......@@ -204,6 +207,10 @@ public class HGKC008A extends DaoEPBase {
eiColumn.setDescName("存货名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INV_SPEC_ID);
eiColumn.setDescName("规格id");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_INV_SPEC);
eiColumn.setDescName("规格");
eiMetadata.addMeta(eiColumn);
......@@ -747,6 +754,14 @@ public class HGKC008A extends DaoEPBase {
this.projName = projName;
}
public Long getInvSpecId() {
return invSpecId;
}
public void setInvSpecId(Long invSpecId) {
this.invSpecId = invSpecId;
}
/**
* get the value from Map.
*
......@@ -774,6 +789,7 @@ public class HGKC008A extends DaoEPBase {
setInventType(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_TYPE)), inventType));
setInventCode(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_CODE)), inventCode));
setInventName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INVENT_NAME)), inventName));
setInvSpecId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_INV_SPEC_ID)), invSpecId));
setInvSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_INV_SPEC)), invSpec));
setInvLength(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INV_LENGTH)), invLength));
setInvWidth(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_INV_WIDTH)), invWidth));
......@@ -813,6 +829,7 @@ public class HGKC008A extends DaoEPBase {
map.put(FIELD_INVENT_TYPE, StringUtils.toString(inventType, eiMetadata.getMeta(FIELD_INVENT_TYPE)));
map.put(FIELD_INVENT_CODE, StringUtils.toString(inventCode, eiMetadata.getMeta(FIELD_INVENT_CODE)));
map.put(FIELD_INVENT_NAME, StringUtils.toString(inventName, eiMetadata.getMeta(FIELD_INVENT_NAME)));
map.put(FIELD_INV_SPEC_ID, StringUtils.toString(invSpecId, eiMetadata.getMeta(FIELD_INV_SPEC_ID)));
map.put(FIELD_INV_SPEC, StringUtils.toString(invSpec, eiMetadata.getMeta(FIELD_INV_SPEC)));
map.put(FIELD_INV_LENGTH, StringUtils.toString(invLength, eiMetadata.getMeta(FIELD_INV_LENGTH)));
map.put(FIELD_INV_WIDTH, StringUtils.toString(invWidth, eiMetadata.getMeta(FIELD_INV_WIDTH)));
......
......@@ -3,9 +3,10 @@ package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.kc.domain.HGKC004;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC008;
import com.baosight.hggp.hg.kc.domain.HGKC008A;
import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.util.*;
import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant;
......@@ -13,6 +14,7 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.math.BigDecimal;
import java.util.*;
......@@ -62,6 +64,11 @@ public class ServiceHGKC008A extends ServiceBase {
// 蓝图ids
List<Long> ids = ObjectUtils.listKey(resultRows, HGKC008A.FIELD_ID);
DaoUtils.update(HGKC008A.BATCH_DELETE, new HashMap<String,Object>(){{put("ids",ids);}});
String receiveId = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC008A.FIELD_RECEIVE_ID);
//查看明细是否都删除了,都删除了得修改主表信息
HGKCTools.HgKc008A.checkMainData(ids,Long.valueOf(receiveId));
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......@@ -77,9 +84,9 @@ public class ServiceHGKC008A extends ServiceBase {
HGKC008A hgkc008a = new HGKC008A();
hgkc008a.fromMap(resultMap);
//查询领料单
HGKC008 hgkc008 = (HGKC008) super.dao.get(HGKC008.QUERY,HGKC008.FIELD_ID,hgkc008a.getReceiveId());
HGKC008 hgkc008 = HGKCTools.HgKc008.getById(hgkc008a.getReceiveId());
this.checkSaveData(hgkc008a,hgkc008);
this.setData(hgkc008a,hgkc008);
this.checkSaveData(hgkc008a);
if(Objects.nonNull(hgkc008a.getId())&&hgkc008a.getId()!=0){
DaoUtils.update(HGKC008A.UPDATE, hgkc008a);
}else {
......@@ -104,6 +111,15 @@ public class ServiceHGKC008A extends ServiceBase {
hgkc008a.setProjName(hgkc008.getProjName());
hgkc008a.setWhCode(hgkc008.getWhCode());
hgkc008a.setWhName(hgkc008.getWhName());
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.DEFAULT) == 0){
//如果明细里面有负数的,主表就是退库
if(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0){
hgkc008.setReceiveType(HGConstant.ReceiveType.TK);
}else{
hgkc008.setReceiveType(HGConstant.ReceiveType.ZC);
}
DaoUtils.update(HGKC008.UPDATE_RECEIVE_TYPE, hgkc008);
}
}
}
......@@ -111,11 +127,18 @@ public class ServiceHGKC008A extends ServiceBase {
* 校验保存的数据
*
* @param hgkc008a
* @param hgkc008
*/
private void checkSaveData(HGKC008A hgkc008a) {
private void checkSaveData(HGKC008A hgkc008a, HGKC008 hgkc008) {
AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
AssertUtils.isNull(hgkc008a.getReceiveId(), "未获取到生产领料单ID信息");
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.ZC) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) < 0, "此生产领料单为正常类型,数量不能小于0");
}
if(hgkc008.getReceiveType().compareTo(HGConstant.ReceiveType.TK) == 0){
AssertUtils.isTrue(hgkc008a.getInvQty().compareTo(BigDecimal.ZERO) > 0, "此生产领料单为退库类型,数量不能大于0");
}
}
}
......
......@@ -175,4 +175,14 @@
WHERE
ID = #id#
</update>
<update id="updateReceiveType">
UPDATE ${hggpSchema}.HGKC008
SET
UPDATED_BY = #updatedBy#, <!-- 更新人 -->
UPDATED_NAME = #updatedName#, <!-- 更新人名称 -->
UPDATED_TIME = #updatedTime#, <!-- 更新时间 -->
RECEIVE_TYPE = #receiveType# <!-- 领料单类型 0:正常,1:退库 -->
WHERE
ID = #id#
</update>
</sqlMap>
......@@ -60,6 +60,9 @@
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME like CONCAT('%',#inventName#,'%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invSpecId">
INV_SPEC_ID = #invSpecId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invSpec">
INV_SPEC = #invSpec#
</isNotEmpty>
......@@ -93,6 +96,9 @@
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME like ('%$projName$%')
</isNotEmpty>
<isNotEmpty prepend=" AND " property="notIds">
id NOT IN <iterate close=")" open="(" conjunction="," property="notIds">#notIds[]#</iterate>
</isNotEmpty>
</sql>
<select id="query" parameterClass="java.util.HashMap"
......@@ -119,6 +125,7 @@
INVENT_TYPE as "inventType", <!-- 存货类型 -->
INVENT_CODE as "inventCode", <!-- 存货编码 -->
INVENT_NAME as "inventName", <!-- 存货名称 -->
INV_SPEC_ID as "invSpecId", <!-- 规格Id -->
INV_SPEC as "invSpec", <!-- 规格 -->
INV_LENGTH as "invLength", <!-- 长度(MM) -->
INV_WIDTH as "invWidth", <!-- 宽度(MM) -->
......@@ -166,6 +173,7 @@
INVENT_TYPE, <!-- 存货类型 -->
INVENT_CODE, <!-- 存货编码 -->
INVENT_NAME, <!-- 存货名称 -->
INV_SPEC_ID, <!-- 规格id -->
INV_SPEC, <!-- 规格 -->
INV_LENGTH, <!-- 长度(MM) -->
INV_WIDTH, <!-- 宽度(MM) -->
......@@ -176,7 +184,7 @@
PRICE, <!-- 单价 -->
AMOUNT <!-- 金额 -->
)
VALUES (#id#, #accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #receiveId#, #companyCode#, #companyName#, #whCode#, #whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invSpec#, #invLength#, #invWidth#, #invThick#, #invQty#, #invUnitWeight#, #invWeight#, #price#, #amount#)
VALUES (#id#, #accountCode#,#projCode#, #projName#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #receiveId#, #companyCode#, #companyName#, #whCode#, #whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invSpecId#,#invSpec#, #invLength#, #invWidth#, #invThick#, #invQty#, #invUnitWeight#, #invWeight#, #price#, #amount#)
</insert>
<delete id="delete">
......@@ -206,6 +214,7 @@
INVENT_TYPE = #inventType#, <!-- 存货类型 -->
INVENT_CODE = #inventCode#, <!-- 存货编码 -->
INVENT_NAME = #inventName#, <!-- 存货名称 -->
INV_SPEC_ID = #invSpecId#, <!-- 规格id -->
INV_SPEC = #invSpec#, <!-- 规格 -->
INV_LENGTH = #invLength#, <!-- 长度(MM) -->
INV_WIDTH = #invWidth#, <!-- 宽度(MM) -->
......
package com.baosight.hggp.hg.kc.tools;
import cn.hutool.core.collection.CollectionUtil;
import com.baosight.hggp.core.dao.DaoBase;
import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.hg.constant.HGConstant;
......@@ -315,6 +316,34 @@ public class HGKCTools {
}
}
public static class HgKc008 {
public static HGKC008 getById(Long id) {
AssertUtils.isEmpty(Collections.singleton(id), "ID为空!");
HGKC008 result = (HGKC008) DaoBase.getInstance().get(HGKC008.QUERY, HGKC008.FIELD_ID, id);
return result;
}
}
public static class HgKc008A {
public static void checkMainData(List<Long> ids,Long receiveId) {
Map paramMap = new HashMap();
paramMap.put("notIds", ids);
paramMap.put("receiveId", receiveId);
List<HGKC008A> results = DaoBase.getInstance().query(HGKC008A.QUERY, paramMap);
//明细都删除了,修改主表类型
if (CollectionUtil.isEmpty(results)){
HGKC008 hgkc008 = new HGKC008();
hgkc008.setId(receiveId);
hgkc008.setReceiveType(HGConstant.ReceiveType.DEFAULT);
DaoUtils.update(HGKC008.UPDATE_RECEIVE_TYPE, hgkc008);
}
}
}
/**
* HGKC010 工具类
*
......
......@@ -35,24 +35,12 @@ $(function (){
return template;
},
editor: function (container, options) {
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("field", options.field);
let dataSource;
EiCommunicator.send("HGKC010", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("invent_code_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
var input = $('<input />');
input.attr("name", options.field);
input.attr("id", options.field);
input.appendTo(container);
input.kendoDropDownList({
dataSource: dataSource,
dataSource: inventRecordBoxBlocks,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
......@@ -115,6 +103,7 @@ $(function (){
}
],
loadComplete: function(grid) {
//选择后,先加载此方法,再加载属性中的方法
// 此 grid 对象
// 处理父子级联动,通过监听 change 事件,判断父级节点是否发生变化
grid.dataSource.bind("change", function(e) {
......@@ -125,6 +114,11 @@ $(function (){
let totalWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'invWeight', totalWeight)
}
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
loadChange(grid,e,"price");
}
//单价计算
if (e.field == "price") {
......@@ -134,8 +128,22 @@ $(function (){
}
}
if (e.field == "inventType") {
//选择后,先加载此方法,再加载属性中的方法,所以存货类型加载时,先修改存货编号下拉框的查询
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("field", options.field);
EiCommunicator.send("HGKC010", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
inventRecordBoxBlocks = ei.getBlock("invent_code_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
resultGrid.setCellValue(item, 'inventCode', "")
resultGrid.setCellValue(item, 'inventName', "")
resultGrid.setCellValue(item, 'invSpecId', "")
resultGrid.setCellValue(item, 'invSpec', "")
resultGrid.setCellValue(item, 'invLength', "")
resultGrid.setCellValue(item, 'invWidth', "")
......@@ -151,6 +159,7 @@ $(function (){
resultGrid.setCellValue(item, 'inventName', inventRecordBoxBlocks[i]['textField'])
}
}
resultGrid.setCellValue(item, 'invSpecId', "")
resultGrid.setCellValue(item, 'invSpec', "")
resultGrid.setCellValue(item, 'invLength', "")
resultGrid.setCellValue(item, 'invWidth', "")
......@@ -169,7 +178,7 @@ $(function (){
resultGrid.setCellValue(item, 'invQty', specBoxBlocks[i]['param4Field'])
resultGrid.setCellValue(item, 'invUnitWeight', specBoxBlocks[i]['param5Field'])
resultGrid.setCellValue(item, 'invWeight', specBoxBlocks[i]['param6Field'])
template = specBoxBlocks[i]['valueField'];
resultGrid.setCellValue(item, 'invSpecId', specBoxBlocks[i]['param7Field'])
}
}
resultGrid.setCellValue(item, 'price', "")
......
......@@ -35,6 +35,7 @@
</EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货编码" enable="true" width="120" align="center" required="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" width="120" align="center" enable="false" required="true"/>
<EF:EFColumn ename="invSpecId" cname="规格id" hidden="true"/>
<EF:EFColumn ename="invSpec" cname="规格" width="120" align="center" required="true" />
<EF:EFColumn ename="invLength" cname="长度(MM)" width="120" align="center" enable="false"/>
<EF:EFColumn ename="invWidth" cname="宽度(MM)" width="120" align="center" enable="false"/>
......
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