Commit 79987fcd by 江和松

其他出库代码优化,以及提交后影响实时库存

parent 57dbacb7
...@@ -66,6 +66,7 @@ public class HGKC007A extends DaoEPBase { ...@@ -66,6 +66,7 @@ public class HGKC007A extends DaoEPBase {
public static final String FIELD_PART_WIDTH = "partWidth"; /* 零件-宽*/ public static final String FIELD_PART_WIDTH = "partWidth"; /* 零件-宽*/
public static final String FIELD_PART_THICK = "partThick"; /* 零件-厚*/ public static final String FIELD_PART_THICK = "partThick"; /* 零件-厚*/
public static final String FIELD_PART_SPEC = "partSpec"; /* 零件规格*/ public static final String FIELD_PART_SPEC = "partSpec"; /* 零件规格*/
public static final String FIELD_PART_SPEC_ID = "partSpecId"; /* 零件规格ID*/
public static final String FIELD_PRIMARY_ID = "primaryId"; /* 主表id*/ public static final String FIELD_PRIMARY_ID = "primaryId"; /* 主表id*/
public static final String FIELD_PRICE = "price"; /* 单价*/ public static final String FIELD_PRICE = "price"; /* 单价*/
public static final String FIELD_AMOUNT = "amount"; /* 金额*/ public static final String FIELD_AMOUNT = "amount"; /* 金额*/
...@@ -115,6 +116,7 @@ public class HGKC007A extends DaoEPBase { ...@@ -115,6 +116,7 @@ public class HGKC007A extends DaoEPBase {
public static final String COL_PART_WIDTH = "PART_WIDTH"; /* 零件-宽*/ public static final String COL_PART_WIDTH = "PART_WIDTH"; /* 零件-宽*/
public static final String COL_PART_THICK = "PART_THICK"; /* 零件-厚*/ public static final String COL_PART_THICK = "PART_THICK"; /* 零件-厚*/
public static final String COL_PART_SPEC = "PART_SPEC"; /* 零件规格*/ public static final String COL_PART_SPEC = "PART_SPEC"; /* 零件规格*/
public static final String COL_PART_SPEC_ID = "PART_SPEC_ID"; /* 零件规格ID*/
public static final String COL_PRIMARY_ID = "PRIMARY_ID"; /* 主表id*/ public static final String COL_PRIMARY_ID = "PRIMARY_ID"; /* 主表id*/
public static final String COL_PRICE = "PRICE"; /* 单价*/ public static final String COL_PRICE = "PRICE"; /* 单价*/
public static final String COL_AMOUNT = "AMOUNT"; /* 金额*/ public static final String COL_AMOUNT = "AMOUNT"; /* 金额*/
...@@ -170,6 +172,7 @@ public class HGKC007A extends DaoEPBase { ...@@ -170,6 +172,7 @@ public class HGKC007A extends DaoEPBase {
private BigDecimal partWidth = new BigDecimal(0.000); /* 零件-宽*/ private BigDecimal partWidth = new BigDecimal(0.000); /* 零件-宽*/
private BigDecimal partThick = new BigDecimal(0.000); /* 零件-厚*/ private BigDecimal partThick = new BigDecimal(0.000); /* 零件-厚*/
private String partSpec = " "; /* 零件规格*/ private String partSpec = " "; /* 零件规格*/
private Long partSpecId = new Long(0); /* 规格id*/
private Long primaryId = new Long(0); /* 主表id*/ private Long primaryId = new Long(0); /* 主表id*/
private BigDecimal price = new BigDecimal("0"); /* 单价*/ private BigDecimal price = new BigDecimal("0"); /* 单价*/
private BigDecimal amount = new BigDecimal("0"); /* 金额*/ private BigDecimal amount = new BigDecimal("0"); /* 金额*/
...@@ -385,6 +388,10 @@ public class HGKC007A extends DaoEPBase { ...@@ -385,6 +388,10 @@ public class HGKC007A extends DaoEPBase {
eiColumn.setDescName("零件规格"); eiColumn.setDescName("零件规格");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PART_SPEC_ID);
eiColumn.setDescName("零件规格ID");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_PRIMARY_ID); eiColumn = new EiColumn(FIELD_PRIMARY_ID);
eiColumn.setDescName("主表id"); eiColumn.setDescName("主表id");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -1185,6 +1192,15 @@ public class HGKC007A extends DaoEPBase { ...@@ -1185,6 +1192,15 @@ public class HGKC007A extends DaoEPBase {
public void setSource(Integer source) { public void setSource(Integer source) {
this.source = source; this.source = source;
} }
public Long getPartSpecId() {
return partSpecId;
}
public void setPartSpecId(Long partSpecId) {
this.partSpecId = partSpecId;
}
/** /**
* get the value from Map. * get the value from Map.
* *
...@@ -1238,6 +1254,7 @@ public class HGKC007A extends DaoEPBase { ...@@ -1238,6 +1254,7 @@ public class HGKC007A extends DaoEPBase {
setPartThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_THICK)), partThick)); setPartThick(NumberUtils.toBigDecimal(StringUtils.toString(map.get(FIELD_PART_THICK)), partThick));
setPartSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_SPEC)), partSpec)); setPartSpec(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_PART_SPEC)), partSpec));
setPrimaryId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PRIMARY_ID)), primaryId)); setPrimaryId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PRIMARY_ID)), primaryId));
setPartSpecId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_PART_SPEC_ID)), partSpecId));
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));
setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source)); setSource(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_SOURCE)), source));
...@@ -1294,6 +1311,7 @@ public class HGKC007A extends DaoEPBase { ...@@ -1294,6 +1311,7 @@ public class HGKC007A extends DaoEPBase {
map.put(FIELD_PART_WIDTH, StringUtils.toString(partWidth, eiMetadata.getMeta(FIELD_PART_WIDTH))); map.put(FIELD_PART_WIDTH, StringUtils.toString(partWidth, eiMetadata.getMeta(FIELD_PART_WIDTH)));
map.put(FIELD_PART_THICK, StringUtils.toString(partThick, eiMetadata.getMeta(FIELD_PART_THICK))); map.put(FIELD_PART_THICK, StringUtils.toString(partThick, eiMetadata.getMeta(FIELD_PART_THICK)));
map.put(FIELD_PART_SPEC, StringUtils.toString(partSpec, eiMetadata.getMeta(FIELD_PART_SPEC))); map.put(FIELD_PART_SPEC, StringUtils.toString(partSpec, eiMetadata.getMeta(FIELD_PART_SPEC)));
map.put(FIELD_PART_SPEC_ID, StringUtils.toString(partSpecId, eiMetadata.getMeta(FIELD_PART_SPEC_ID)));
map.put(FIELD_PRIMARY_ID, StringUtils.toString(primaryId, eiMetadata.getMeta(FIELD_PRIMARY_ID))); map.put(FIELD_PRIMARY_ID, StringUtils.toString(primaryId, eiMetadata.getMeta(FIELD_PRIMARY_ID)));
map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE))); map.put(FIELD_PRICE, StringUtils.toString(price, eiMetadata.getMeta(FIELD_PRICE)));
map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT))); map.put(FIELD_AMOUNT, StringUtils.toString(amount, eiMetadata.getMeta(FIELD_AMOUNT)));
......
...@@ -169,7 +169,7 @@ public class ServiceHGKC006 extends ServiceBase { ...@@ -169,7 +169,7 @@ public class ServiceHGKC006 extends ServiceBase {
hgkc006.fromMap(map); hgkc006.fromMap(map);
DaoUtils.update(HGKC006.CHECK, hgkc006.toMap()); DaoUtils.update(HGKC006.CHECK, hgkc006.toMap());
} }
List<HGKC006A> hgkc006AList = HGKCTools.HgKc006A.getHgkc008aList(hgkc006.getId()); List<HGKC006A> hgkc006AList = HGKCTools.HgKc006A.getHgkc006aList(hgkc006.getId());
AssertUtils.isEmpty(hgkc006AList, "没有明细信息无法提交"); AssertUtils.isEmpty(hgkc006AList, "没有明细信息无法提交");
if(!CollectionUtils.isEmpty(hgkc006AList)){ if(!CollectionUtils.isEmpty(hgkc006AList)){
for(HGKC006A hgkc006A : hgkc006AList){ for(HGKC006A hgkc006A : hgkc006AList){
......
...@@ -5,7 +5,6 @@ import com.baosight.hggp.common.DdynamicEnum; ...@@ -5,7 +5,6 @@ import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils; import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.*; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.tools.HGKCTools; import com.baosight.hggp.hg.kc.tools.HGKCTools;
import com.baosight.hggp.util.*; import com.baosight.hggp.util.*;
...@@ -15,7 +14,6 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -15,7 +14,6 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import java.math.BigDecimal;
import java.util.*; import java.util.*;
/** /**
...@@ -86,8 +84,8 @@ public class ServiceHGKC006A extends ServiceBase { ...@@ -86,8 +84,8 @@ public class ServiceHGKC006A extends ServiceBase {
*/ */
@OperationLogAnnotation(operModul = "其他入库单明细", operType = "插入", operDesc = "保存") @OperationLogAnnotation(operModul = "其他入库单明细", operType = "插入", operDesc = "保存")
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try {
try {Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock); Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
HGKC006A hgkc006a = new HGKC006A(); HGKC006A hgkc006a = new HGKC006A();
hgkc006a.fromMap(resultMap); hgkc006a.fromMap(resultMap);
//查询主单 //查询主单
......
...@@ -8,10 +8,10 @@ import com.baosight.hggp.hg.constant.HGConstant; ...@@ -8,10 +8,10 @@ import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.cw.tools.HGCWTools; import com.baosight.hggp.hg.cw.tools.HGCWTools;
import com.baosight.hggp.hg.cw.vo.UserVO; import com.baosight.hggp.hg.cw.vo.UserVO;
import com.baosight.hggp.hg.kc.domain.HGKC003; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.domain.HGKC007;
import com.baosight.hggp.hg.kc.domain.HGKC007; import com.baosight.hggp.hg.kc.domain.HGKC007;
import com.baosight.hggp.hg.kc.domain.HGKC007; import com.baosight.hggp.hg.kc.domain.HGKC007;
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.utils.HGUtils; import com.baosight.hggp.hg.utils.HGUtils;
import com.baosight.hggp.hg.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
...@@ -22,7 +22,9 @@ import com.baosight.iplat4j.core.ei.EiInfo; ...@@ -22,7 +22,9 @@ import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -163,6 +165,22 @@ public class ServiceHGKC007 extends ServiceBase { ...@@ -163,6 +165,22 @@ public class ServiceHGKC007 extends ServiceBase {
hgkc007.fromMap(map); hgkc007.fromMap(map);
DaoUtils.update(HGKC007.CHECK, hgkc007.toMap()); DaoUtils.update(HGKC007.CHECK, hgkc007.toMap());
} }
List<HGKC007A> hgkc007AList = HGKCTools.HgKc007A.getHgkc007aList(hgkc007.getId());
AssertUtils.isEmpty(hgkc007AList, "没有明细信息无法提交");
if(!CollectionUtils.isEmpty(hgkc007AList)){
for(HGKC007A hgkc007A : hgkc007AList){
//需要为负数
BigDecimal qty = hgkc007A.getInvQty().multiply(new BigDecimal(-1));
BigDecimal invUnitWeight = hgkc007A.getInvUnitWeight().multiply(new BigDecimal(-1));
BigDecimal invWeight = hgkc007A.getInvWeight().multiply(new BigDecimal(-1));
//减少库存
HGKCUtils.HgKc010.updateInv(hgkc007A.getCompanyCode(),hgkc007A.getWhCode(),
hgkc007A.getPartSpecId(),qty,
invUnitWeight,invWeight);
}
}
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("提交成功!");
} catch (PlatException e) { } catch (PlatException e) {
eiInfo.setStatus(EiConstant.STATUS_FAILURE); eiInfo.setStatus(EiConstant.STATUS_FAILURE);
eiInfo.setMsg("提交失败,原因参见详细错误描述!"); eiInfo.setMsg("提交失败,原因参见详细错误描述!");
...@@ -170,8 +188,6 @@ public class ServiceHGKC007 extends ServiceBase { ...@@ -170,8 +188,6 @@ public class ServiceHGKC007 extends ServiceBase {
logError("提交失败!", e.getMessage()); logError("提交失败!", e.getMessage());
return eiInfo; return eiInfo;
} }
eiInfo.setStatus(EiConstant.STATUS_SUCCESS);
eiInfo.setMsg("提交成功!");
return eiInfo; return eiInfo;
} }
......
...@@ -3,16 +3,18 @@ package com.baosight.hggp.hg.kc.service; ...@@ -3,16 +3,18 @@ package com.baosight.hggp.hg.kc.service;
import com.baosight.hggp.aspect.annotation.OperationLogAnnotation; import com.baosight.hggp.aspect.annotation.OperationLogAnnotation;
import com.baosight.hggp.common.DdynamicEnum; import com.baosight.hggp.common.DdynamicEnum;
import com.baosight.hggp.core.dao.DaoUtils; import com.baosight.hggp.core.dao.DaoUtils;
import com.baosight.hggp.core.security.UserSessionUtils;
import com.baosight.hggp.hg.constant.HGConstant; import com.baosight.hggp.hg.constant.HGConstant;
import com.baosight.hggp.hg.kc.domain.HGKC006; import com.baosight.hggp.hg.kc.domain.*;
import com.baosight.hggp.hg.kc.domain.HGKC006A;
import com.baosight.hggp.hg.kc.domain.HGKC007; import com.baosight.hggp.hg.kc.domain.HGKC007;
import com.baosight.hggp.hg.kc.domain.HGKC007A; import com.baosight.hggp.hg.kc.domain.HGKC007A;
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.xs.tools.HGXSTools; import com.baosight.hggp.hg.xs.tools.HGXSTools;
import com.baosight.hggp.util.AssertUtils; import com.baosight.hggp.util.AssertUtils;
import com.baosight.hggp.util.CommonMethod; import com.baosight.hggp.util.CommonMethod;
import com.baosight.hggp.util.EiInfoUtils;
import com.baosight.hggp.util.LogUtils; import com.baosight.hggp.util.LogUtils;
import com.baosight.hggp.util.contants.ACConstants; import com.baosight.hggp.util.contants.ACConstants;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
...@@ -21,10 +23,7 @@ import com.baosight.iplat4j.core.exception.PlatException; ...@@ -21,10 +23,7 @@ import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; 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.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 其他出库明细 * 其他出库明细
...@@ -44,8 +43,15 @@ public class ServiceHGKC007A extends ServiceBase { ...@@ -44,8 +43,15 @@ public class ServiceHGKC007A 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.INVENT_TYPE_BOX_BLOCK_ID), null, false); String whCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC007A.FIELD_WH_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_RECORD_BOX_BLOCK_ID), null, false); String companyCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC007A.FIELD_COMPANY_CODE);
Map map = new HashMap();
map.put(HGKC007A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC007A.FIELD_WH_CODE, whCode);
map.put(HGKC007A.FIELD_COMPANY_CODE, companyCode);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID,DdynamicEnum.SPEC_BOX_BLOCK_ID),map,false
);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC007A().eiMetadata); inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HGKC007A().eiMetadata);
} catch (PlatException e) { } catch (PlatException e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败"); LogUtils.setDetailMsg(inInfo, e, "初始化失败");
...@@ -64,6 +70,15 @@ public class ServiceHGKC007A extends ServiceBase { ...@@ -64,6 +70,15 @@ public class ServiceHGKC007A extends ServiceBase {
public EiInfo query(EiInfo inInfo) { public EiInfo query(EiInfo inInfo) {
try { try {
inInfo = super.query(inInfo, HGKC007A.QUERY, new HGKC007A()); inInfo = super.query(inInfo, HGKC007A.QUERY, new HGKC007A());
String whCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC007A.FIELD_WH_CODE);
String companyCode = inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC007A.FIELD_COMPANY_CODE);
Map map = new HashMap();
map.put(HGKC007A.FIELD_ACCOUNT_CODE, UserSessionUtils.getAccountCode());
map.put(HGKC007A.FIELD_WH_CODE, whCode);
map.put(HGKC007A.FIELD_COMPANY_CODE, companyCode);
CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.INVENT_TYPE_BOX_BLOCK_ID,DdynamicEnum.INVENT_CODE_BOX_BLOCK_ID,DdynamicEnum.SPEC_BOX_BLOCK_ID),map,false
);
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败"); LogUtils.setDetailMsg(inInfo, e, "查询失败");
} }
...@@ -79,94 +94,55 @@ public class ServiceHGKC007A extends ServiceBase { ...@@ -79,94 +94,55 @@ public class ServiceHGKC007A extends ServiceBase {
@OperationLogAnnotation(operModul = "其他出库明细", operType = "插入", operDesc = "保存") @OperationLogAnnotation(operModul = "其他出库明细", operType = "插入", operDesc = "保存")
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); Map resultMap = EiInfoUtils.getFirstRow(inInfo,EiConstant.resultBlock);
// 数据校验 HGKC007A hgkc007a = new HGKC007A();
this.checkSaveData(resultRows); hgkc007a.fromMap(resultMap);
// 写入数据 //查询主单
for (int i = 0; i < resultRows.size(); i++) { HGKC007 hgkc007 = HGKCTools.HgKc007.getById(hgkc007a.getPrimaryId());
HGKC007A hgkc007A = new HGKC007A(); this.checkSaveData(hgkc007a,hgkc007);
hgkc007A.fromMap(resultRows.get(i)); this.setData(hgkc007a,hgkc007);
if (hgkc007A.getId() == null || hgkc007A.getId() == 0) { if(Objects.nonNull(hgkc007a.getId())&&hgkc007a.getId()!=0){
Map queryMap = new HashMap(); DaoUtils.update(HGKC007A.UPDATE, hgkc007a);
queryMap.put("id",inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC006A.FIELD_PRIMARY_ID)); }else {
List<HGKC007> list = this.dao.query(HGKC007.QUERY,queryMap); hgkc007a.setPrimaryId(hgkc007.getId());
this.add(hgkc007A,list.get(0)); hgkc007a.setOtherOutNo(hgkc007.getOtherOutNo());
} else { DaoUtils.insert(HGKC007A.INSERT, hgkc007a);
this.modify(hgkc007A);
}
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
} catch (Exception e) { } catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "保存失败"); LogUtils.setDetailMsg(inInfo, e, "保存失败");
} }
return inInfo; return inInfo;
} }
/** private void setData(HGKC007A hgkc007a, HGKC007 hgkc007) {
* 校验保存的数据 if(Objects.nonNull(hgkc007)){
* hgkc007a.setProjCode(hgkc007.getProjCode());
* @param resultRows hgkc007a.setProjName(hgkc007.getProjName());
*/ hgkc007a.setWhCode(hgkc007.getWhCode());
private void checkSaveData(List<Map> resultRows) { hgkc007a.setWhName(hgkc007.getWhName());
// 数据校验 hgkc007a.setCompanyCode(hgkc007.getCompanyCode());
for (int i = 0; i < resultRows.size(); i++) { hgkc007a.setCompanyName(hgkc007.getCompanyName());
HGKC007A hgkc007A = new HGKC007A(); hgkc007a.setSource(hgkc007.getSource());
hgkc007A.fromMap(resultRows.get(i));
//AssertUtils.isNull(hgkc007A.getStatus(), "是否启用不能为空");
}
}
/**
* 新增
*
* @param hgkc007A
* @throws Exception
*/
private void add(HGKC007A hgkc007A,HGKC007 hgkc007) throws Exception {
hgkc007A.setPrimaryId(hgkc007.getId());
hgkc007A.setOtherOutNo(hgkc007.getOtherOutNo());
DaoUtils.insert(HGKC007A.INSERT, hgkc007A);
// 更新库存数量
HGKCUtils.HgKc010.updateInv(hgkc007.getCompanyCode(), hgkc007.getWhCode(), hgkc007A.getInventRecordId(),
hgkc007A.getInvQty().negate(), hgkc007A.getInvUnitWeight().negate(), hgkc007A.getInvWeight().negate());
} }
/**
* 修改数据
*
* @param hgkc007A
*/
private void modify(HGKC007A hgkc007A) {
DaoUtils.update(HGKC007A.UPDATE, hgkc007A);
} }
/** /**
* 修改操作 * 校验保存的数据
*
* @param inInfo
* @return
*/ */
@OperationLogAnnotation(operModul = "其他出库明细", operType = "修改", operDesc = "修改操作") private void checkSaveData(HGKC007A hgkc007a, HGKC007 hgkc007) {
public EiInfo update(EiInfo inInfo) { AssertUtils.isEmpty(UserSessionUtils.getAccountCode(), "当前用户未绑定公司,无法操作数据,请联系管理员!");
try { AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); AssertUtils.isNull(hgkc007a.getPrimaryId(), "未获取到其他出库单ID信息");
// 数据校验 HGKC010 hgkc010 = HGKCTools.HgKc010.get(hgkc007a.getCompanyCode(),hgkc007a.getWhCode(),hgkc007a.getPartSpecId());
this.checkSaveData(resultRows); if (hgkc010==null){
for (int i = 0; i < resultRows.size(); i++) { throw new PlatException("实时库存不存在!");
HGKC007A hppz009 = new HGKC007A();
hppz009.fromMap(resultRows.get(i));
DaoUtils.update(HGKC007A.UPDATE, hppz009);
} }
inInfo = this.query(inInfo); int result = hgkc007a.getInvQty().compareTo(hgkc010.getInvQty());
inInfo.setStatus(EiConstant.STATUS_DEFAULT); if ( result > 0){
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据修改成功!"); throw new PlatException("实时库存数量不够,无法保存!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "修改失败");
} }
return inInfo;
} }
/** /**
...@@ -182,18 +158,7 @@ public class ServiceHGKC007A extends ServiceBase { ...@@ -182,18 +158,7 @@ public class ServiceHGKC007A extends ServiceBase {
for (int i = 0; i < resultRows.size(); i++) { for (int i = 0; i < resultRows.size(); i++) {
HGKC007A hgkc007A = new HGKC007A(); HGKC007A hgkc007A = new HGKC007A();
hgkc007A.fromMap(resultRows.get(i)); hgkc007A.fromMap(resultRows.get(i));
// 校验企业下是否存在用户
int count = HGXSTools.XsUser.countByAccount(hgkc007A.getAccountCode());
if (count > 0) {
// throw new PlatException(String.format("企业[%s]已关联用户,请先解除用户", hgkc007A.getAccountName()));
}
DaoUtils.update(HGKC007A.DELETE, hgkc007A); DaoUtils.update(HGKC007A.DELETE, hgkc007A);
// 扣减库存
Map queryMap = new HashMap();
queryMap.put("id",inInfo.getCellStr(EiConstant.queryBlock, ACConstants.ROW_CODE_0, HGKC006A.FIELD_PRIMARY_ID));
List<HGKC007> list = this.dao.query(HGKC007.QUERY,queryMap);
HGKCUtils.HgKc010.updateInv(list.get(0).getCompanyCode(), list.get(0).getWhCode(), hgkc007A.getInventRecordId(),
hgkc007A.getInvQty(), hgkc007A.getInvWeight());
} }
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
......
...@@ -132,10 +132,12 @@ public class ServiceHGKC008 extends ServiceBase { ...@@ -132,10 +132,12 @@ public class ServiceHGKC008 extends ServiceBase {
for(HGKC008A hgkc008A : hgkc008AList){ for(HGKC008A hgkc008A : hgkc008AList){
//领料如果是正数则为出库,需要减少库存,如果是退回则要加库存 //领料如果是正数则为出库,需要减少库存,如果是退回则要加库存
BigDecimal qty = hgkc008A.getInvQty().multiply(new BigDecimal(-1)); BigDecimal qty = hgkc008A.getInvQty().multiply(new BigDecimal(-1));
BigDecimal invUnitWeight = hgkc008A.getInvUnitWeight().multiply(new BigDecimal(-1));
BigDecimal invWeight = hgkc008A.getInvWeight().multiply(new BigDecimal(-1));
//增加库存 //增加库存
HGKCUtils.HgKc010.updateInv(hgkc008A.getCompanyCode(),hgkc008A.getWhCode(), HGKCUtils.HgKc010.updateInv(hgkc008A.getCompanyCode(),hgkc008A.getWhCode(),
hgkc008A.getInvSpecId(),qty, hgkc008A.getInvSpecId(),qty,
hgkc008A.getInvUnitWeight(),hgkc008A.getInvWeight()); invUnitWeight,invWeight);
} }
} }
inInfo.setStatus(EiConstant.STATUS_SUCCESS); inInfo.setStatus(EiConstant.STATUS_SUCCESS);
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <!-- table information <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd">
Generate time : 2024-05-24 16:31:37
Version : 1.0
schema : hggp
tableName : HGKC007A
ID BIGINT NOT NULL primarykey,
ACCOUNT_CODE VARCHAR,
DEP_CODE VARCHAR,
CREATED_BY VARCHAR NOT NULL,
CREATED_NAME VARCHAR NOT NULL,
CREATED_TIME VARCHAR NOT NULL,
UPDATED_BY VARCHAR NOT NULL,
UPDATED_NAME VARCHAR NOT NULL,
UPDATED_TIME VARCHAR NOT NULL,
DELETE_FLAG TINYINT,
COMPANY_CODE VARCHAR,
COMPANY_NAME VARCHAR,
OTHER_OUT_DATE VARCHAR,
OTHER_OUT_NO VARCHAR NOT NULL,
WH_CODE VARCHAR,
WH_NAME VARCHAR,
INVENT_RECORD_ID BIGINT,
INVENT_TYPE VARCHAR,
INVENT_CODE VARCHAR NOT NULL,
INVENT_NAME VARCHAR NOT NULL,
INV_QTY DECIMAL,
INV_UNIT_WEIGHT DECIMAL,
INV_WEIGHT DECIMAL,
OTHER_OUT_NO_OLD VARCHAR,
REMARK VARCHAR,
FACTORY_CODE VARCHAR,
PROD_ORDER_NO VARCHAR,
PROD_TASK_NO VARCHAR,
PROJ_CODE VARCHAR,
PROJ_NAME VARCHAR,
PRDT_TYPE TINYINT,
PRDT_CODE VARCHAR,
PRDT_NAME VARCHAR,
PRDT_LENGTH DECIMAL,
PRDT_WIDTH DECIMAL,
PRDT_THICK DECIMAL,
PRDT_SPEC VARCHAR,
PART_TYPE TINYINT,
PART_CODE VARCHAR,
PART_NAME VARCHAR,
PART_LENGTH DECIMAL,
PART_WIDTH DECIMAL,
PART_THICK DECIMAL,
PART_SPEC VARCHAR,
PRIMARY_ID BIGINT,
PRICE DECIMAL,
AMOUNT DECIMAL,
SOURCE TINYINT
-->
<sqlMap namespace="HGKC007A"> <sqlMap namespace="HGKC007A">
<sql id="condition"> <sql id="condition">
...@@ -188,6 +135,9 @@ ...@@ -188,6 +135,9 @@
<isNotEmpty prepend=" AND " property="partSpec"> <isNotEmpty prepend=" AND " property="partSpec">
PART_SPEC = #partSpec# PART_SPEC = #partSpec#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="partSpecId">
PART_SPEC_ID = #partSpecId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryId"> <isNotEmpty prepend=" AND " property="primaryId">
PRIMARY_ID = #primaryId# PRIMARY_ID = #primaryId#
</isNotEmpty> </isNotEmpty>
...@@ -249,6 +199,7 @@ ...@@ -249,6 +199,7 @@
PART_WIDTH as "partWidth", <!-- 零件-宽 --> PART_WIDTH as "partWidth", <!-- 零件-宽 -->
PART_THICK as "partThick", <!-- 零件-厚 --> PART_THICK as "partThick", <!-- 零件-厚 -->
PART_SPEC as "partSpec", <!-- 零件规格 --> PART_SPEC as "partSpec", <!-- 零件规格 -->
PART_SPEC_ID as "partSpecId", <!-- 零件规格id -->
PRIMARY_ID as "primaryId", <!-- 主表id --> PRIMARY_ID as "primaryId", <!-- 主表id -->
PRICE as "price", <!-- 单价 --> PRICE as "price", <!-- 单价 -->
AMOUNT as "amount", <!-- 金额 --> AMOUNT as "amount", <!-- 金额 -->
...@@ -271,153 +222,6 @@ ...@@ -271,153 +222,6 @@
<include refid="condition" /> <include refid="condition" />
</select> </select>
<!--
<isNotEmpty prepend=" AND " property="id">
ID = #id#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="accountCode">
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="depCode">
DEP_CODE = #depCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdBy">
CREATED_BY = #createdBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdName">
CREATED_NAME = #createdName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="createdTime">
CREATED_TIME = #createdTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedBy">
UPDATED_BY = #updatedBy#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedName">
UPDATED_NAME = #updatedName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="updatedTime">
UPDATED_TIME = #updatedTime#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="companyName">
COMPANY_NAME = #companyName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutDate">
OTHER_OUT_DATE = #otherOutDate#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutNo">
OTHER_OUT_NO = #otherOutNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whCode">
WH_CODE = #whCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="whName">
WH_NAME = #whName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventRecordId">
INVENT_RECORD_ID = #inventRecordId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventType">
INVENT_TYPE = #inventType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventCode">
INVENT_CODE = #inventCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="inventName">
INVENT_NAME = #inventName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invQty">
INV_QTY = #invQty#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invUnitWeight">
INV_UNIT_WEIGHT = #invUnitWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="invWeight">
INV_WEIGHT = #invWeight#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="otherOutNoOld">
OTHER_OUT_NO_OLD = #otherOutNoOld#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="remark">
REMARK = #remark#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodOrderNo">
PROD_ORDER_NO = #prodOrderNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prodTaskNo">
PROD_TASK_NO = #prodTaskNo#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projCode">
PROJ_CODE = #projCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="projName">
PROJ_NAME = #projName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtType">
PRDT_TYPE = #prdtType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtCode">
PRDT_CODE = #prdtCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtName">
PRDT_NAME = #prdtName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtLength">
PRDT_LENGTH = #prdtLength#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtWidth">
PRDT_WIDTH = #prdtWidth#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtThick">
PRDT_THICK = #prdtThick#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="prdtSpec">
PRDT_SPEC = #prdtSpec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partType">
PART_TYPE = #partType#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partCode">
PART_CODE = #partCode#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partName">
PART_NAME = #partName#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partLength">
PART_LENGTH = #partLength#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partWidth">
PART_WIDTH = #partWidth#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partThick">
PART_THICK = #partThick#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="partSpec">
PART_SPEC = #partSpec#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="primaryId">
PRIMARY_ID = #primaryId#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="price">
PRICE = #price#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="amount">
AMOUNT = #amount#
</isNotEmpty>
<isNotEmpty prepend=" AND " property="source">
SOURCE = #source#
</isNotEmpty>
-->
<insert id="insert"> <insert id="insert">
INSERT INTO ${hggpSchema}.HGKC007A (ID, INSERT INTO ${hggpSchema}.HGKC007A (ID,
ACCOUNT_CODE, <!-- 企业编码 --> ACCOUNT_CODE, <!-- 企业编码 -->
...@@ -463,12 +267,13 @@ ...@@ -463,12 +267,13 @@
PART_WIDTH, <!-- 零件-宽 --> PART_WIDTH, <!-- 零件-宽 -->
PART_THICK, <!-- 零件-厚 --> PART_THICK, <!-- 零件-厚 -->
PART_SPEC, <!-- 零件规格 --> PART_SPEC, <!-- 零件规格 -->
PART_SPEC_ID, <!-- 零件规格id -->
PRIMARY_ID, <!-- 主表id --> PRIMARY_ID, <!-- 主表id -->
PRICE, <!-- 单价 --> PRICE, <!-- 单价 -->
AMOUNT, <!-- 金额 --> AMOUNT, <!-- 金额 -->
SOURCE <!-- 数据来源 --> SOURCE <!-- 数据来源 -->
) )
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #otherOutDate#, #otherOutNo#, #whCode#, #whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invQty#, #invUnitWeight#, #invWeight#, #otherOutNoOld#, #remark#, #factoryCode#, #prodOrderNo#, #prodTaskNo#, #projCode#, #projName#, #prdtType#, #prdtCode#, #prdtName#, #prdtLength#, #prdtWidth#, #prdtThick#, #prdtSpec#, #partType#, #partCode#, #partName#, #partLength#, #partWidth#, #partThick#, #partSpec#, #primaryId#, #price#, #amount#, #source#) VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #otherOutDate#, #otherOutNo#, #whCode#, #whName#, #inventRecordId#, #inventType#, #inventCode#, #inventName#, #invQty#, #invUnitWeight#, #invWeight#, #otherOutNoOld#, #remark#, #factoryCode#, #prodOrderNo#, #prodTaskNo#, #projCode#, #projName#, #prdtType#, #prdtCode#, #prdtName#, #prdtLength#, #prdtWidth#, #prdtThick#, #prdtSpec#, #partType#, #partCode#, #partName#, #partLength#, #partWidth#, #partThick#, #partSpec#, #partSpecId#,#primaryId#, #price#, #amount#, #source#)
</insert> </insert>
<delete id="delete"> <delete id="delete">
...@@ -521,6 +326,7 @@ ...@@ -521,6 +326,7 @@
PART_WIDTH = #partWidth#, <!-- 零件-宽 --> PART_WIDTH = #partWidth#, <!-- 零件-宽 -->
PART_THICK = #partThick#, <!-- 零件-厚 --> PART_THICK = #partThick#, <!-- 零件-厚 -->
PART_SPEC = #partSpec#, <!-- 零件规格 --> PART_SPEC = #partSpec#, <!-- 零件规格 -->
PART_SPEC_ID = #partSpecId#, <!-- 零件规格id -->
PRIMARY_ID = #primaryId#, <!-- 主表id --> PRIMARY_ID = #primaryId#, <!-- 主表id -->
PRICE = #price#, <!-- 单价 --> PRICE = #price#, <!-- 单价 -->
AMOUNT = #amount#, <!-- 金额 --> AMOUNT = #amount#, <!-- 金额 -->
......
...@@ -325,7 +325,7 @@ public class HGKCTools { ...@@ -325,7 +325,7 @@ public class HGKCTools {
} }
public static class HgKc006A { public static class HgKc006A {
public static List<HGKC006A> getHgkc008aList(Long primaryId) { public static List<HGKC006A> getHgkc006aList(Long primaryId) {
Map paramMap = new HashMap(); Map paramMap = new HashMap();
paramMap.put("primaryId", primaryId); paramMap.put("primaryId", primaryId);
List<HGKC006A> results = DaoBase.getInstance().query(HGKC006A.QUERY, paramMap); List<HGKC006A> results = DaoBase.getInstance().query(HGKC006A.QUERY, paramMap);
...@@ -334,6 +334,24 @@ public class HGKCTools { ...@@ -334,6 +334,24 @@ public class HGKCTools {
} }
public static class HgKc007 {
public static HGKC007 getById(Long id) {
AssertUtils.isEmpty(Collections.singleton(id), "ID为空!");
HGKC007 result = (HGKC007) DaoBase.getInstance().get(HGKC007.QUERY, HGKC007.FIELD_ID, id);
return result;
}
}
public static class HgKc007A {
public static List<HGKC007A> getHgkc007aList(Long primaryId) {
Map paramMap = new HashMap();
paramMap.put("primaryId", primaryId);
List<HGKC007A> results = DaoBase.getInstance().query(HGKC007A.QUERY, paramMap);
return results;
}
}
public static class HgKc008 { public static class HgKc008 {
public static HGKC008 getById(Long id) { public static HGKC008 getById(Long id) {
......
...@@ -20,7 +20,7 @@ $(function () { ...@@ -20,7 +20,7 @@ $(function () {
// 详情 // 详情
if (item.id) { if (item.id) {
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="jump(' + item.id + ',\''+item.submitStatus+'\',\''+item.whCode+'\',\''+item.companyCode+'\')" >详情</a>'; + 'onclick="jump(' + item.id + ',\''+item.submitStatus+'\',\''+item.whCode+'\',\''+item.companyCode+'\',\''+item.source+'\')" >详情</a>';
} }
return template; return template;
} }
...@@ -151,9 +151,13 @@ function check(id, auditStatus) { ...@@ -151,9 +151,13 @@ function check(id, auditStatus) {
); );
} }
//详情 //详情
function jump(id,submitStatus,whCode,companyCode) { function jump(id,submitStatus,whCode,companyCode,source) {
JSColorbox.open({ JSColorbox.open({
href: "HGKC006A?methodName=initLoad&inqu_status-0-primaryId=" + id+"&inqu_status-0-whCode="+whCode+"&inqu_status-0-companyCode="+companyCode+"&inqu_status-0-submitStatus="+submitStatus, href: "HGKC006A?methodName=initLoad&inqu_status-0-primaryId=" + id
+"&inqu_status-0-whCode="+whCode
+"&inqu_status-0-companyCode="+companyCode
+"&inqu_status-0-submitStatus="+submitStatus
+"&inqu_status-0-source="+source,
title: "<div style='text-align: center;'>其他入库详情</div>", title: "<div style='text-align: center;'>其他入库详情</div>",
width: "80%", width: "80%",
height: "80%", height: "80%",
......
...@@ -219,7 +219,9 @@ $(function () { ...@@ -219,7 +219,9 @@ $(function () {
$(window).load(function () { $(window).load(function () {
query(); query();
let submitStatus = $("#inqu_status-0-submitStatus").val(); let submitStatus = $("#inqu_status-0-submitStatus").val();
if(submitStatus==1){ let source = $("#inqu_status-0-source").val();
//只有手动录入的才能修改
if(submitStatus==1 || source != "1"){
$(".k-grid-add").hide(); $(".k-grid-add").hide();
$(".k-grid-save-changes").hide(); $(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide(); $(".k-grid-cancel-changes").hide();
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<EF:EFInput ename="inqu_status-0-whCode" cname="仓库编码" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-whCode" cname="仓库编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-companyCode" cname="仓库编码" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-companyCode" cname="仓库编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-submitStatus" cname="状态" colWidth="3" type="hidden"/> <EF:EFInput ename="inqu_status-0-submitStatus" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-source" cname="来源" colWidth="3" type="hidden"/>
<div class="row"> <div class="row">
<%-- <EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" filter="contains" <%-- <EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" filter="contains"
defultValue=""> defultValue="">
......
...@@ -20,7 +20,7 @@ $(function () { ...@@ -20,7 +20,7 @@ $(function () {
// 详情 // 详情
if (item.id) { if (item.id) {
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="jump(' + item.id + ',\''+item.submitStatus+'\')" >详情</a>'; + 'onclick="jump(' + item.id + ',\''+item.submitStatus+'\',\''+item.whCode+'\',\''+item.companyCode+'\',\''+item.source+'\')" >详情</a>';
} }
return template; return template;
} }
...@@ -148,9 +148,17 @@ function check(id, auditStatus) { ...@@ -148,9 +148,17 @@ function check(id, auditStatus) {
} }
//详情 //详情
function jump(id,submitStatus) { function jump(id,submitStatus,whCode,companyCode,source) {
var herf = ctx + "\\web\\" + "HGKC007A?inqu_status-0-primaryId=" + id + "&inqu_status-0-submitStatus="+ submitStatus +"&efParentFormEname=HGKC007"; JSColorbox.open({
window.open(herf); href: "HGKC007A?methodName=initLoad&inqu_status-0-primaryId=" + id
+"&inqu_status-0-whCode="+whCode
+"&inqu_status-0-companyCode="+companyCode
+"&inqu_status-0-submitStatus="+submitStatus
+"&inqu_status-0-source="+source,
title: "<div style='text-align: center;'>其他出库详情</div>",
width: "80%",
height: "80%",
});
} }
/** /**
......
let InventNameGlobalData = [];
let inventAllGlobalData = [];
$(function () { $(function () {
$(".row").children().attr("class", "col-md-3");
var inventRecordBoxBlocks = __eiInfo.getBlock("invent_code_box_block_id").getMappedRows();
var specBoxBlocks = __eiInfo.getBlock("spec_box_block_id").getMappedRows();
// 查询
$("#QUERY").on("click", query);
IPLATUI.EFGrid.result = { IPLATUI.EFGrid.result = {
pageable: { pageable: {
...@@ -9,84 +14,179 @@ $(function () { ...@@ -9,84 +14,179 @@ $(function () {
}, },
columns: [{ columns: [{
field: "inventCode", field: "inventCode",
filter: function (options) { template: function (item) {
return _.filter(InventNameGlobalData, function (item) { let template = "";
return item["param1Field"]=="true"; if(item.inventCode){
}) for(let i=0;i<inventRecordBoxBlocks.length;i++){
}, if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
template: function (dataItem) { template = inventRecordBoxBlocks[i]['valueField'];
for (let i = 0; i < InventNameGlobalData.length; i++) { }
if (InventNameGlobalData[i]['valueField'] === dataItem['inventCode']) {
dataItem['inventName'] = InventNameGlobalData[i]['param1Field'];
return InventNameGlobalData[i]['textField'];
} }
} }
return ""; return template;
}, },
editor: function (container, options) { editor: function (container, options) {
let inInfo = new EiInfo(); var input = $('<input />');
inInfo.set("inqu_status-0-isSplicingSymbol", false); input.attr("name", options.field);
inInfo.set("serviceName", "HGPZ005"); input.attr("id", options.field);
inInfo.set("methodName", "queryInventNameBox"); input.appendTo(container);
inInfo.set("blockId", "invent_name_box_block_id"); input.kendoDropDownList({
inInfo.set("field", options.field); dataSource: inventRecordBoxBlocks,
refreshSelect(container, inInfo); minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
} }
},{ },
field: "invQty", {
field: "partSpec",
template: function (item) { template: function (item) {
if(item.invQty && item.invUnitWeight){ let template = "";
let invWeight = item.invQty * item.invUnitWeight; if(item.partSpec){
//item['invWeight'] = invWeight.toString(); for(let i=0;i<specBoxBlocks.length;i++){
resultGrid.setCellValue(item, 'invWeight', invWeight); if(item.partSpec === specBoxBlocks[i]['valueField']){
template = specBoxBlocks[i]['valueField'];
} }
if(item.invQty && item.price){
let amount = item.invQty * item.price;
//item['amount'] = amount.toString();
resultGrid.setCellValue(item, 'amount', amount);
} }
return item.invQty;
} }
}, { return template;
field: "invUnitWeight", },
template: function (item) { editor: function (container, options) {
if(item.invQty && item.invUnitWeight){ let inInfo = new EiInfo();
let invWeight = item.invQty * item.invUnitWeight; inInfo.set("inqu_status-0-whCode", options.model["whCode"]);
//item['invWeight'] = invWeight.toString(); inInfo.set("inqu_status-0-companyCode", options.model["companyCode"]);
resultGrid.setCellValue(item, 'invWeight', invWeight); inInfo.set("inqu_status-0-inventType", options.model["inventType"]);
inInfo.set("inqu_status-0-inventCode", options.model["inventCode"]);
inInfo.set("field", options.field);
let dataSource;
EiCommunicator.send("HGKC010", "querySpecBox", inInfo, {
onSuccess: function (ei) {
dataSource = ei.getBlock("spec_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,
minLength: 0,
dataTextField: "textField",
dataValueField: "valueField",
optionLabelTemplate: "[#:valueField#]#:textField#",
valueTemplate: "[#:valueField#]#:textField#",
template: "[#:valueField#]#:textField#",
filter: "contains"
});
} }
return item.invUnitWeight; },
{
field: "primaryId",
template: function (item) {
item['primaryId'] =$("#inqu_status-0-primaryId").val();
return $("#inqu_status-0-primaryId").val();
} }
},{ },
field: "price", {
field: "whCode",
template: function (item) { template: function (item) {
if(item.invQty && item.price){ item['whCode'] =$("#inqu_status-0-whCode").val();
let amount = item.invQty * item.price; return $("#inqu_status-0-whCode").val();
//item['amount'] = amount.toString();
resultGrid.setCellValue(item, 'amount', amount);
} }
return item.price; },
{
field: "companyCode",
template: function (item) {
item['companyCode'] =$("#inqu_status-0-companyCode").val();
return $("#inqu_status-0-companyCode").val();
} }
},], }],
loadComplete: function (grid) { loadComplete: function (grid) {
// 此grid对象 // 此grid对象
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
if (e.field == "inventCode") {
var tr,index;
// 获取此model元素信息
var item = e.items[0]; var item = e.items[0];
for (let i = 0; i < inventAllGlobalData.length; i++) { //数量计算
if (inventAllGlobalData[i]['valueField'] === item.inventCode) { if (e.field == "invQty") {
resultGrid.setCellValue(item, 'partSpec', inventAllGlobalData[i]['param2Field']) if(item.invQty && item.invUnitWeight){
resultGrid.setCellValue(item, 'inventType', inventAllGlobalData[i]['param3Field']) let totalWeight = item.invQty * item.invUnitWeight;
resultGrid.setCellValue(item, 'partLength', inventAllGlobalData[i]['param4Field']) resultGrid.setCellValue(item, 'invWeight', totalWeight)
resultGrid.setCellValue(item, 'partWidth', inventAllGlobalData[i]['param5Field']) }
resultGrid.setCellValue(item, 'partThick', inventAllGlobalData[i]['param6Field']) if(item.price && item.invQty){
resultGrid.setCellValue(item, 'coefficient', inventAllGlobalData[i]['param7Field']) let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'inventRecordId', inventAllGlobalData[i]['param8Field']) resultGrid.setCellValue(item, 'amount', totalAmount)
calUnitWeight(item,inventAllGlobalData[i]['param4Field'],inventAllGlobalData[i]['param5Field'],inventAllGlobalData[i]['param6Field'],inventAllGlobalData[i]['param7Field']); }
loadChange(grid,e,"price");
}
//单价计算
if (e.field == "price") {
if(item.price && item.invQty){
let totalAmount = item.price * item.invQty;
resultGrid.setCellValue(item, 'amount', totalAmount)
}
}
if (e.field == "inventType") {
//选择后,先加载此方法,再加载属性中的方法,所以存货类型加载时,先修改存货编号下拉框的查询
let inInfo = new EiInfo();
inInfo.set("inqu_status-0-whCode",item.whCode);
inInfo.set("inqu_status-0-companyCode",item.companyCode);
inInfo.set("inqu_status-0-inventType",item.inventType);
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, 'partSpecId', "")
resultGrid.setCellValue(item, 'partSpec', "")
resultGrid.setCellValue(item, 'partLength', "")
resultGrid.setCellValue(item, 'partWidth', "")
resultGrid.setCellValue(item, 'partThick', "")
resultGrid.setCellValue(item, 'invQty', "")
resultGrid.setCellValue(item, 'invUnitWeight', "")
resultGrid.setCellValue(item, 'invWeight', "")
loadChange(grid,e,"inventCode");
}
if (e.field == "inventCode") {
for(let i=0;i<inventRecordBoxBlocks.length;i++){
if(item.inventCode === inventRecordBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'inventName', inventRecordBoxBlocks[i]['textField'])
}
}
resultGrid.setCellValue(item, 'partSpecId', "")
resultGrid.setCellValue(item, 'partSpec', "")
resultGrid.setCellValue(item, 'partLength', "")
resultGrid.setCellValue(item, 'partWidth', "")
resultGrid.setCellValue(item, 'partThick', "")
resultGrid.setCellValue(item, 'invQty', "")
resultGrid.setCellValue(item, 'invUnitWeight', "")
resultGrid.setCellValue(item, 'invWeight', "")
loadChange(grid,e,"partSpec");
}
if (e.field == "partSpec") {
for(let i=0;i<specBoxBlocks.length;i++){
if(item.partSpec === specBoxBlocks[i]['valueField']){
resultGrid.setCellValue(item, 'partLength', specBoxBlocks[i]['param1Field'])
resultGrid.setCellValue(item, 'partWidth', specBoxBlocks[i]['param2Field'])
resultGrid.setCellValue(item, 'partThick', specBoxBlocks[i]['param3Field'])
resultGrid.setCellValue(item, 'invQty', specBoxBlocks[i]['param4Field'])
resultGrid.setCellValue(item, 'invUnitWeight', specBoxBlocks[i]['param5Field'])
resultGrid.setCellValue(item, 'invWeight', specBoxBlocks[i]['param6Field'])
resultGrid.setCellValue(item, 'partSpecId', specBoxBlocks[i]['param7Field'])
} }
} }
resultGrid.setCellValue(item, 'price', "")
resultGrid.setCellValue(item, 'amount', "")
loadChange(grid,e,"invQty");
} }
}); });
}, },
...@@ -106,13 +206,6 @@ $(function () { ...@@ -106,13 +206,6 @@ $(function () {
} }
} }
} }
// 查询
$("#QUERY").on("click", query);
// 选择生产任务
$("#SELECT_TASK").on("click", selectTask);
}); });
/** /**
...@@ -121,7 +214,9 @@ $(function () { ...@@ -121,7 +214,9 @@ $(function () {
$(window).load(function () { $(window).load(function () {
query(); query();
let submitStatus = $("#inqu_status_0_submitStatus").val(); let submitStatus = $("#inqu_status_0_submitStatus").val();
if(submitStatus==1){ let source = $("#inqu_status-0-source").val();
//只有手动录入的才能修改
if(submitStatus==1 || source != "1"){
$(".k-grid-add").hide(); $(".k-grid-add").hide();
$(".k-grid-save-changes").hide(); $(".k-grid-save-changes").hide();
$(".k-grid-cancel-changes").hide(); $(".k-grid-cancel-changes").hide();
...@@ -134,51 +229,6 @@ $(window).load(function () { ...@@ -134,51 +229,6 @@ $(window).load(function () {
*/ */
let query = function () { let query = function () {
resultGrid.dataSource.page(1); resultGrid.dataSource.page(1);
initInvent();
initSpec();
}
/**
* 初始化存货
*/
let initInvent = function () {
let inInfo = new EiInfo();
EiCommunicator.send("HGPZ005", "queryInventCodeBox", inInfo, {
onSuccess: function (ei) {
InventNameGlobalData = ei.getBlock("invent_record_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 初始化规格
*/
let initSpec = function () {
let inInfo = new EiInfo();
//inInfo.set("inqu_status-0-inventTypes", [1, 2]);
inInfo.set("inqu_status-0-isSplicingSymbol", false);
EiCommunicator.send("HGPZ005", "queryInventNameBox", inInfo, {
onSuccess: function (ei) {
inventAllGlobalData = ei.getBlock("invent_name_box_block_id").getMappedRows();
},
onFail: function (ei) {
}
}, {async: false});
}
/**
* 选择生产任务
*/
let selectTask = function () {
JSColorbox.open({
href: "HGKC003A?methodName=initLoad",
title: "<div style='text-align: center;'>生产任务查询</div>",
width: "80%",
height: "80%",
callbackName: selectTaskCallback
});
} }
/** /**
......
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
<EF:EFPage title="其他出库单明细"> <EF:EFPage title="其他出库单明细">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<EF:EFInput ename="inqu_status-0-primaryId" cname="领料单id" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-whCode" cname="仓库编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-companyCode" cname="仓库编码" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-submitStatus" cname="状态" colWidth="3" type="hidden"/>
<EF:EFInput ename="inqu_status-0-source" cname="来源" colWidth="3" type="hidden"/>
<div class="row"> <div class="row">
<%-- <EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" filter="contains" <%-- <EF:EFSelect cname="存货名称" blockId="inqu_status" ename="inventCode" row="0" colWidth="3" filter="contains"
defultValue=""> defultValue="">
...@@ -22,14 +27,18 @@ ...@@ -22,14 +27,18 @@
<EF:EFRegion id="result" title="明细信息"> <EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row"> <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="primaryId" cname="主表id" hidden="true"/>
<EF:EFColumn ename="whCode" cname="仓库编码" hidden="true"/>
<EF:EFColumn ename="companyCode" cname="公司编号" hidden="true"/>
<EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true" <EF:EFComboColumn ename="inventType" cname="存货类型" width="120" align="center" required="true"
blockName="invent_type_box_block_id" textField="textField" valueField="valueField" blockName="invent_type_box_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#" enable="false" columnTemplate="#=textField#" itemTemplate="#=textField#" readonly="false"
filter="contains"> filter="contains">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/> <EF:EFColumn ename="inventCode" cname="存货名称" width="120" align="center" required="true" readonly="true"/>
<EF:EFColumn ename="inventName" cname="存货名称" hidden="true"/> <EF:EFColumn ename="inventName" cname="存货名称" hidden="true"/>
<EF:EFColumn ename="partSpec" cname="规格" width="120" align="center" enable="false"/> <EF:EFColumn ename="partSpec" cname="规格" width="120" align="center" enable="true" required="true"/>
<EF:EFColumn ename="partSpecId" cname="规格id" hidden="true"/>
<EF:EFColumn ename="inventRecordId" cname="规格id" width="120" align="center" required="true" enable="false" hidden="true"/> <EF:EFColumn ename="inventRecordId" cname="规格id" width="120" align="center" required="true" enable="false" hidden="true"/>
<EF:EFColumn ename="partLength" cname="长(MM)" enable="false" width="80" align="right" format="{0:N3}"/> <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="partWidth" cname="宽(MM)" enable="false" width="80" align="right" format="{0:N3}"/>
...@@ -37,18 +46,21 @@ ...@@ -37,18 +46,21 @@
<EF:EFColumn ename="invQty" cname="数量" width="120" align="right" format="{0:N0}" <EF:EFColumn ename="invQty" cname="数量" width="120" align="right" format="{0:N0}"
defaultValue="0" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/> data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
required="true"/>
<EF:EFColumn ename="invUnitWeight" cname="单重" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="invUnitWeight" cname="单重" width="120" align="right" format="{0:N3}"
defaultValue="0" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/> data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
enable="false"/>
<EF:EFColumn ename="invWeight" cname="总重" enable="false" width="120" align="right" format="{0:N3}"/> <EF:EFColumn ename="invWeight" cname="总重" enable="false" width="120" align="right" format="{0:N3}"/>
<EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/> <EF:EFColumn ename="prdtCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/> <EF:EFColumn ename="partCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:N3}" <EF:EFColumn ename="price" cname="单价" width="120" align="right" format="{0:N3}"
defaultValue="0" defaultValue="0"
data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/" data-regex="/^-?[0-9]{1,17}([.][0-9]{1,3})?$/"
data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"/> data-errorprompt="请输入数字,该值最大可设置17位整数和3位小数!"
required="true"/>
<EF:EFColumn ename="amount" cname="金额" width="120" align="right" enable="false" format="{0:N3}"/> <EF:EFColumn ename="amount" cname="金额" width="120" align="right" enable="false" format="{0:N3}"/>
</EF:EFGrid> </EF:EFGrid>
</EF:EFRegion> </EF:EFRegion>
......
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