Commit 87d93816 by wuwenlong

售后退货

parent 8cfb6074
package com.baosight.hpjx.common;
/**
* @author:songx
* @date:2024/2/5,11:33
*/
public enum ReturnStatusEnum {
RETURNING(0, "退货中"),
RETURNED(1, "退货完成(已收货)");
private Integer code;
private String value;
ReturnStatusEnum(Integer code, String value) {
this.code = code;
this.value = value;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
...@@ -64,6 +64,8 @@ public class HPConstant { ...@@ -64,6 +64,8 @@ public class HPConstant {
public static final String HPPZ017_SALES_CODE = "HPPZ017_SALES_CODE"; public static final String HPPZ017_SALES_CODE = "HPPZ017_SALES_CODE";
//销售计划单号 //销售计划单号
public static final String PLAN_SALES_CODE = "PLAN_SALES_CODE"; public static final String PLAN_SALES_CODE = "PLAN_SALES_CODE";
// 退货单号
public static final String HPKC013_RETURN_NO = "HPKC013_RETURN_NO";
} }
/** /**
......
...@@ -236,14 +236,11 @@ public class HPSqlConstant { ...@@ -236,14 +236,11 @@ public class HPSqlConstant {
/** /**
* HPKC013 SQL 定义 * HPKC013 SQL 定义
*
* @author:songx
* @date:2024/1/20,16:45
*/ */
public class HPKC013 { public class HPKC013 {
// 锁 // 锁
public static final String UPDATE_STATUS = "HPKC013.updateStatus"; public static final String LOCK = "HPKC013.lock";
} }
/** /**
......
...@@ -46,6 +46,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -46,6 +46,7 @@ public class HPKC004 extends DaoEPBase {
public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/ public static final String FIELD_KC_ID = "kcId"; /* 库存ID*/
public static final String FIELD_OLD_SALE_NO = "oldSaleNo"; /* 原销售单号*/ public static final String FIELD_OLD_SALE_NO = "oldSaleNo"; /* 原销售单号*/
public static final String FIELD_IS_PRINT = "isPrint"; /* 是否打印:0.否1.是*/ public static final String FIELD_IS_PRINT = "isPrint"; /* 是否打印:0.否1.是*/
public static final String FIELD_IS_RETURN = "isReturn"; /* 是否申请退货 0.否1.是*/
public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/ public static final String FIELD_CREATED_BY = "createdBy"; /* 创建人*/
public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/ public static final String FIELD_CREATED_NAME = "createdName"; /* 创建人名称*/
public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/ public static final String FIELD_CREATED_TIME = "createdTime"; /* 创建时间*/
...@@ -82,6 +83,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -82,6 +83,7 @@ public class HPKC004 extends DaoEPBase {
public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/ public static final String COL_KC_ID = "KC_ID"; /* 库存ID*/
public static final String COL_OLD_SALE_NO = "OLD_SALE_NO"; /* 原销售单号*/ public static final String COL_OLD_SALE_NO = "OLD_SALE_NO"; /* 原销售单号*/
public static final String COL_IS_PRINT = "IS_PRINT"; /* 是否打印:0.否1.是*/ public static final String COL_IS_PRINT = "IS_PRINT"; /* 是否打印:0.否1.是*/
public static final String COL_IS_RETURN = "IS_RETURN"; /* 是否申请退货 0.否1.是*/
public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/ public static final String COL_CREATED_BY = "CREATED_BY"; /* 创建人*/
public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/ public static final String COL_CREATED_NAME = "CREATED_NAME"; /* 创建人名称*/
public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/ public static final String COL_CREATED_TIME = "CREATED_TIME"; /* 创建时间*/
...@@ -123,6 +125,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -123,6 +125,7 @@ public class HPKC004 extends DaoEPBase {
private Long kcId; /* 库存ID*/ private Long kcId; /* 库存ID*/
private String oldSaleNo = " "; /* 原销售单号*/ private String oldSaleNo = " "; /* 原销售单号*/
private Integer isPrint; /* 是否打印:0.否1.是*/ private Integer isPrint; /* 是否打印:0.否1.是*/
private Integer isReturn; /* 是否申请退货 0.否1.是*/
private String createdBy = " "; /* 创建人*/ private String createdBy = " "; /* 创建人*/
private String createdName = " "; /* 创建人名称*/ private String createdName = " "; /* 创建人名称*/
private String createdTime = " "; /* 创建时间*/ private String createdTime = " "; /* 创建时间*/
...@@ -255,6 +258,10 @@ public class HPKC004 extends DaoEPBase { ...@@ -255,6 +258,10 @@ public class HPKC004 extends DaoEPBase {
eiColumn.setDescName("是否打印:0.否1.是"); eiColumn.setDescName("是否打印:0.否1.是");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_IS_RETURN);
eiColumn.setDescName("是否申请退货 0.否1.是");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn(FIELD_CREATED_BY); eiColumn = new EiColumn(FIELD_CREATED_BY);
eiColumn.setDescName("创建人"); eiColumn.setDescName("创建人");
eiMetadata.addMeta(eiColumn); eiMetadata.addMeta(eiColumn);
...@@ -687,6 +694,15 @@ public class HPKC004 extends DaoEPBase { ...@@ -687,6 +694,15 @@ public class HPKC004 extends DaoEPBase {
public void setIsPrint(Integer isPrint) { public void setIsPrint(Integer isPrint) {
this.isPrint = isPrint; this.isPrint = isPrint;
} }
public Integer getIsReturn() {
return isReturn;
}
public void setIsReturn(Integer isReturn) {
this.isReturn = isReturn;
}
/** /**
* get the createdBy - 创建人. * get the createdBy - 创建人.
* @return the createdBy * @return the createdBy
...@@ -879,6 +895,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -879,6 +895,7 @@ public class HPKC004 extends DaoEPBase {
setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId)); setKcId(NumberUtils.toLong(StringUtils.toString(map.get(FIELD_KC_ID)), kcId));
setOldSaleNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_SALE_NO)), oldSaleNo)); setOldSaleNo(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_OLD_SALE_NO)), oldSaleNo));
setIsPrint(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_PRINT)), isPrint)); setIsPrint(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_PRINT)), isPrint));
setIsReturn(NumberUtils.toInteger(StringUtils.toString(map.get(FIELD_IS_RETURN)), isReturn));
setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy)); setCreatedBy(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_BY)), createdBy));
setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName)); setCreatedName(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_NAME)), createdName));
setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime)); setCreatedTime(StringUtils.defaultIfEmpty(StringUtils.toString(map.get(FIELD_CREATED_TIME)), createdTime));
...@@ -922,6 +939,7 @@ public class HPKC004 extends DaoEPBase { ...@@ -922,6 +939,7 @@ public class HPKC004 extends DaoEPBase {
map.put(FIELD_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID))); map.put(FIELD_KC_ID, StringUtils.toString(kcId, eiMetadata.getMeta(FIELD_KC_ID)));
map.put(FIELD_OLD_SALE_NO, StringUtils.toString(oldSaleNo, eiMetadata.getMeta(FIELD_OLD_SALE_NO))); map.put(FIELD_OLD_SALE_NO, StringUtils.toString(oldSaleNo, eiMetadata.getMeta(FIELD_OLD_SALE_NO)));
map.put(FIELD_IS_PRINT, StringUtils.toString(isPrint, eiMetadata.getMeta(FIELD_IS_PRINT))); map.put(FIELD_IS_PRINT, StringUtils.toString(isPrint, eiMetadata.getMeta(FIELD_IS_PRINT)));
map.put(FIELD_IS_RETURN, StringUtils.toString(isReturn, eiMetadata.getMeta(FIELD_IS_RETURN)));
map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY))); map.put(FIELD_CREATED_BY, StringUtils.toString(createdBy, eiMetadata.getMeta(FIELD_CREATED_BY)));
map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME))); map.put(FIELD_CREATED_NAME, StringUtils.toString(createdName, eiMetadata.getMeta(FIELD_CREATED_NAME)));
map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME))); map.put(FIELD_CREATED_TIME, StringUtils.toString(createdTime, eiMetadata.getMeta(FIELD_CREATED_TIME)));
......
...@@ -3,12 +3,14 @@ package com.baosight.hpjx.hp.kc.service; ...@@ -3,12 +3,14 @@ package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum; import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum; import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.common.ReturnStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant; import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004; import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC010; import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.domain.HPKC011; import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.hpjx.hp.kc.domain.HPKC013;
import com.baosight.hpjx.hp.kc.tools.HPKCTools; import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.util.BeanUtils; import com.baosight.hpjx.util.BeanUtils;
import com.baosight.hpjx.util.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
...@@ -138,4 +140,39 @@ public class ServiceHPKC004 extends ServiceBase { ...@@ -138,4 +140,39 @@ public class ServiceHPKC004 extends ServiceBase {
} }
return inInfo; return inInfo;
} }
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "销售出库单",operType = "修改",operDesc = "申请退货")
public EiInfo returnApply(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 销售单号
List<String> saleNos = ObjectUtils.listKey(resultRows, "saleNo");
// 锁记录
HPKCTools.HpKc004.lock(saleNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC004 fKc004 = new HPKC004();
fKc004.fromMap(resultRows.get(i));
DaoUtils.update("HPKC004.returnApply", fKc004);
HPKC013 hpkc013 = new HPKC013();
BeanUtils.copyProperties(fKc004,hpkc013);
hpkc013.setReturnNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC013_RETURN_NO));
hpkc013.setReturnStatus(ReturnStatusEnum.RETURNING.getCode());
DaoUtils.update(HPKC013.INSERT, hpkc013);
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
} }
package com.baosight.hpjx.hp.kc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.common.DdynamicEnum;
import com.baosight.hpjx.common.InventTypeEnum;
import com.baosight.hpjx.common.ReturnStatusEnum;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC013;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.hpjx.hp.kc.tools.HPKCTools;
import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.MapUtils;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ServiceHPKC013 extends ServiceBase {
// 指定存货类型
private static final Integer[] DEFAULT_INVENT_CODE = {InventTypeEnum.RAW.getCode(),
InventTypeEnum.CONSUMABLE.getCode(), InventTypeEnum.SEMI_FINISHED_PRODUCT.getCode(),
InventTypeEnum.FINISHED_PRODUCT.getCode()};
/**
* 画面初始化
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "退货单",operType = "查询",operDesc = "初始化")
public EiInfo initLoad(EiInfo inInfo) {
try {
Map queryMap = new HashMap();
queryMap.put("inventTypes", DEFAULT_INVENT_CODE);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.WH_RECORD_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_NAME_BLOCK_ID), queryMap);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.INVENT_SPEC_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.SPEC_NAME_BLOCK_ID), queryMap, false);
CommonMethod.initBlock(inInfo, Arrays.asList(DdynamicEnum.FACTORY_RECORD_BLOCK_ID), null, false);
inInfo.addBlock(EiConstant.resultBlock).addBlockMeta(new HPKC013().eiMetadata);
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "初始化失败");
}
return inInfo;
}
/**
* 查询操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "退货单",operType = "查询",operDesc = "查询")
@Override
public EiInfo query(EiInfo inInfo) {
try {
Map queryRow = EiInfoUtils.getFirstRow(inInfo);
String receiptDate = MapUtils.getString(queryRow, "receiptDate");
queryRow.put("receiptDate", StringUtil.removeSpecifiedCharacter(receiptDate,
StringUtil.DEFAULT_CHARACTER_TO_BE_REMOVED));
queryRow.put("inventTypes", DEFAULT_INVENT_CODE);
inInfo = super.query(inInfo, HPKC013.QUERY, new HPKC013());
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "查询失败");
}
return inInfo;
}
@OperationLogAnnotation(operModul = "确认收货",operType = "修改",operDesc = "退货确认收货")
public EiInfo comfirmReturn(EiInfo inInfo){
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 退货单号
List<String> returnNos = ObjectUtils.listKey(resultRows, "returnNo");
// 锁记录
HPKCTools.HpKc013.lock(returnNos);
// 查询数据库记录
Map<String, HPKC013> mapKc013 = HPKCTools.HpKc013.map(returnNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC011 hpkc011 = null;
HPKC010 hpkc010 = null;
HPKC013 fKc013 = new HPKC013();
fKc013.fromMap(resultRows.get(i));
if (!fKc013.getSubInventCode().equals(" ")) {
hpkc011 = HPKCTools.HpKc011.listById(fKc013.getKcId());
}else {
hpkc010 = HPKCTools.HpKc010.listById(fKc013.getKcId());
}
HPKC013 dbKc013 = mapKc013.get(fKc013.getReturnNo());
if(dbKc013.getReturnStatus().compareTo(ReturnStatusEnum.RETURNING.getCode())==0) {
dbKc013.setReturnStatus(ReturnStatusEnum.RETURNED.getCode());
DaoUtils.update(HPKC013.UPDATE, dbKc013);
// 修改库存
if (hpkc010 != null) {
HPKCTools.updateStock(dbKc013.getWhCode(), hpkc010.getInventRecordId(),
dbKc013.getAmount(), dbKc013.getWeight().multiply(new BigDecimal(1000)), hpkc010.getFactoryCode());
} else {
HPKCTools.updateProdStock(dbKc013.getWhCode(), dbKc013.getProdNo(),
dbKc013.getAmount(), dbKc013.getWeight(), hpkc011.getFactoryCode());
}
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据确认收货成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "确认收货失败");
}
return inInfo;
}
/**
* 删除操作
*
* @param inInfo
* @return
*/
@OperationLogAnnotation(operModul = "退货单",operType = "删除",operDesc = "删除")
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 退货单号
List<String> returnNos = ObjectUtils.listKey(resultRows, "returnNo");
// 锁记录
HPKCTools.HpKc013.lock(returnNos);
// 查询数据库记录
Map<String, HPKC013> mapKc013 = HPKCTools.HpKc013.map(returnNos);
for (int i = 0; i < resultRows.size(); i++) {
HPKC011 hpkc011 = null;
HPKC010 hpkc010 = null;
HPKC013 fKc013 = new HPKC013();
fKc013.fromMap(resultRows.get(i));
if (!fKc013.getSubInventCode().equals(" ")) {
hpkc011 = HPKCTools.HpKc011.listById(fKc013.getKcId());
}else {
hpkc010 = HPKCTools.HpKc010.listById(fKc013.getKcId());
}
DaoUtils.update(HPKC013.DELETE, fKc013);
DaoUtils.update("HPKC004.returnCollback", new HPKC004(){{setSaleNo(fKc013.getSaleNo());}});
// 生成红冲记录
HPKC013 dbKc013 = mapKc013.get(fKc013.getReturnNo());
//已收货的退货单才红冲
if(dbKc013.getReturnStatus().compareTo(ReturnStatusEnum.RETURNED.getCode())==0) {
HPKC013 newKc013 = BeanUtils.copy(dbKc013, HPKC013.class);
newKc013.setReturnNo(SequenceGenerator.getNextSequence(HPConstant.SequenceId.HPKC013_RETURN_NO));
newKc013.setAmount(dbKc013.getAmount().negate());
newKc013.setWeight(dbKc013.getWeight().negate());
newKc013.setOldReturnNo(dbKc013.getSaleNo());
newKc013.setProjCode(dbKc013.getProjCode());
newKc013.setProjName(dbKc013.getProjName());
newKc013.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.insert(HPKC013.INSERT, newKc013);
// 修改库存
if (hpkc010 != null) {
HPKCTools.updateStock(dbKc013.getWhCode(), hpkc010.getInventRecordId(),
newKc013.getAmount(), newKc013.getWeight().multiply(new BigDecimal(1000)), hpkc010.getFactoryCode());
} else {
HPKCTools.updateProdStock(dbKc013.getWhCode(), dbKc013.getProdNo(),
newKc013.getAmount(), newKc013.getWeight(), hpkc011.getFactoryCode());
}
}
}
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
} catch (Exception e) {
LogUtils.setDetailMsg(inInfo, e, "删除失败");
}
return inInfo;
}
}
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
<isNotEmpty prepend=" AND " property="isPrint"> <isNotEmpty prepend=" AND " property="isPrint">
IS_PRINT = #isPrint# IS_PRINT = #isPrint#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag"> <isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag# DELETE_FLAG = #deleteFlag#
</isNotEmpty> </isNotEmpty>
...@@ -184,6 +185,7 @@ ...@@ -184,6 +185,7 @@
KC_ID, <!-- 库存ID --> KC_ID, <!-- 库存ID -->
OLD_SALE_NO, <!-- 原销售单号 --> OLD_SALE_NO, <!-- 原销售单号 -->
IS_PRINT, <!-- 是否打印:0.否1.是 --> IS_PRINT, <!-- 是否打印:0.否1.是 -->
IS_RENTURN,
CREATED_BY, <!-- 创建人 --> CREATED_BY, <!-- 创建人 -->
CREATED_NAME, <!-- 创建人名称 --> CREATED_NAME, <!-- 创建人名称 -->
CREATED_TIME, <!-- 创建时间 --> CREATED_TIME, <!-- 创建时间 -->
...@@ -194,7 +196,7 @@ ...@@ -194,7 +196,7 @@
#companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#, #prodNo#, #companyCode#, #depCode#, #receiptDate#, #saleNo#, #whCode#, #whName#, #prodNo#,
#projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#, #projCode#, #projName#, #inventCode#, #inventName#, #subInventCode#, #subInventName#,
#length#, #width#, #thick#, #amount#, #unitWeight#, #weight#, #remark#, #kcId#, #length#, #width#, #thick#, #amount#, #unitWeight#, #weight#, #remark#, #kcId#,
#oldSaleNo#, #isPrint#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,#factoryCode#, #factoryName# #oldSaleNo#, #isPrint#, #isReturn#, #createdBy#, #createdName#, #createdTime#, #deleteFlag#,#factoryCode#, #factoryName#
) )
</insert> </insert>
...@@ -203,6 +205,16 @@ ...@@ -203,6 +205,16 @@
UPDATE ${hpjxSchema}.T_HPKC004 SET DELETE_FLAG = 1 WHERE ID = #id# UPDATE ${hpjxSchema}.T_HPKC004 SET DELETE_FLAG = 1 WHERE ID = #id#
</delete> </delete>
<!-- 退货申请 -->
<delete id="returnApply">
UPDATE ${hpjxSchema}.T_HPKC004 SET IS_RENTURN = 1 WHERE ID = #id#
</delete>
<!-- 退货申请回滚 -->
<delete id="returnCollback">
UPDATE ${hpjxSchema}.T_HPKC004 SET IS_RENTURN = 0 WHERE SALE_NO = #saleNo#
</delete>
<update id="update"> <update id="update">
UPDATE ${hpjxSchema}.T_HPKC004 UPDATE ${hpjxSchema}.T_HPKC004
SET SET
......
...@@ -3,15 +3,7 @@ package com.baosight.hpjx.hp.kc.tools; ...@@ -3,15 +3,7 @@ package com.baosight.hpjx.hp.kc.tools;
import com.baosight.hpjx.core.dao.DaoBase; import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPSqlConstant; import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.kc.domain.HPKC001; import com.baosight.hpjx.hp.kc.domain.*;
import com.baosight.hpjx.hp.kc.domain.HPKC002;
import com.baosight.hpjx.hp.kc.domain.HPKC003;
import com.baosight.hpjx.hp.kc.domain.HPKC004;
import com.baosight.hpjx.hp.kc.domain.HPKC005;
import com.baosight.hpjx.hp.kc.domain.HPKC006;
import com.baosight.hpjx.hp.kc.domain.HPKC007;
import com.baosight.hpjx.hp.kc.domain.HPKC010;
import com.baosight.hpjx.hp.kc.domain.HPKC011;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -628,6 +620,74 @@ public class HPKCTools { ...@@ -628,6 +620,74 @@ public class HPKCTools {
} }
/**
* HPKC013 公共方法定义
*
*/
public static class HpKc013 {
/**
* 锁
*
* @param returnNos
* @return
*/
public static void lock(List<String> returnNos) {
if (CollectionUtils.isEmpty(returnNos)) {
return;
}
Map queryMap = new HashMap();
queryMap.put("returnNos", returnNos);
DaoBase.getInstance().update(HPSqlConstant.HPKC013.LOCK, queryMap);
}
/**
* 查询销售出库信息
*
* @param ids
* @return
*/
public static List<HPKC013> listById(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPKC013.QUERY, queryMap);
}
/**
* 查询销售出库信息
*
* @param returnNos
* @return
*/
public static List<HPKC013> list(List<String> returnNos) {
if (CollectionUtils.isEmpty(returnNos)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("returnNos", returnNos);
return DaoBase.getInstance().query(HPKC013.QUERY, queryMap);
}
/**
* 查询销售出库信息
*
* @param returnNos
* @return
*/
public static Map<String, HPKC013> map(List<String> returnNos) {
List<HPKC013> results = list(returnNos);
if (CollectionUtils.isEmpty(results)) {
return null;
}
return results.stream().collect(Collectors.toMap(HPKC013::getReturnNo, item -> item));
}
}
/** /**
* 查询产品库存信息 * 查询产品库存信息
......
...@@ -29,6 +29,9 @@ $(function () { ...@@ -29,6 +29,9 @@ $(function () {
// 导出打印 // 导出打印
$("#PRINT").on("click", exportPrint); $("#PRINT").on("click", exportPrint);
// 退货
$("#RETURN_APPLY").on("click", returnApply);
}); });
...@@ -111,3 +114,35 @@ let exportPrint = function () { ...@@ -111,3 +114,35 @@ let exportPrint = function () {
window.location = IPLATUI.CONTEXT_PATH + "/HP/KC/HPKC90.jsp?route=1&parameter=" window.location = IPLATUI.CONTEXT_PATH + "/HP/KC/HPKC90.jsp?route=1&parameter="
+ encodeURI(encodeURI(JSON.stringify(parameter))); + encodeURI(encodeURI(JSON.stringify(parameter)));
} }
function returnApply(){
//重置全局变量
ids = [];
let rows = resultGrid.getCheckedRows()
if (rows.length < 1) {
message("请至少选择一条需要退货的数据");
return;
}
let factoryCodes = null;
let flag = true;
$.each(rows, function(index, item) {
let isReturn= item.get("isReturn");
if(isReturn == 1){
IPLAT.alert({
message : "选中的出库单已申请退货!",
okFn : function(e) {
},
title : '错误'
});
flag = false;
return false;
}
});
if(flag) {
JSUtils.confirm("确定对勾选中的[" + rows.length + "]条数据做\"退货\"操作? ", {
ok: function () {
JSUtils.submitGridsData("result", "HPKC004", "returnApply", true);
}
});
}
}
\ No newline at end of file
...@@ -64,6 +64,9 @@ ...@@ -64,6 +64,9 @@
<EF:EFComboColumn ename="isPrint" cname="是否制单" width="80" align="center"> <EF:EFComboColumn ename="isPrint" cname="是否制单" width="80" align="center">
<EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/> <EF:EFCodeOption codeName="hpjx.hpjx.isPrint"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="isReturn" cname="是否退货" width="80" align="center" hidden="true">
<EF:EFCodeOption codeName="hpjx.hpjx.isReturn"/>
</EF:EFComboColumn>
<EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center" /> <EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center" />
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center" hidden="true"/> <EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center" hidden="true"/> <EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center" hidden="true"/>
......
$(function () {
IPLATUI.EFGrid = {
"result": {
columns: [{
field: "operator",
template: function (item) {
let returnStatus = item.returnStatus;
let template = '';
if (returnStatus) {
if (returnStatus == 0) {
template += '<a style="cursor: pointer;display: inline-flex;justify-content: center;" ' +
'onclick="check(' + item.returnNo + ',1)" >确认收货</a>';
}
}
return template;
}
},{
field: "createdName",
template: function (options) {
return showUserName(options.createdBy, options.createdName);
}
}],
loadComplete: function (grid) {
}
},
onSuccess: function (e) {
if(e.eiInfo.extAttr.methodName == 'delete' ){
query();
}
}
}
// 查询
$("#QUERY").on("click", query);
});
/**
* 页面加载时执行
*/
$(window).load(function () {
// 查询
query();
});
/**
* 查询
*/
let query = function () {
resultGrid.dataSource.page(1);
}
function check(returnNo, auditStatus) {
const inEiInfo = new EiInfo();
inEiInfo.set("result-0-returnNo", returnNo);
inEiInfo.set("result-0-returnStatus", returnStatus);
EiCommunicator.send('HPKC013', 'comfirmReturn', inEiInfo, {
onSuccess(response) {
message("提交成功,已生确认收货");
resultGrid.dataSource.page(1);
},
onFail(errorMessage, status, e) {
NotificationUtil("执行失败!", "error");
}
},
{
async: false
}
);
}
\ No newline at end of file
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="EF" tagdir="/WEB-INF/tags/EF" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="退货单">
<EF:EFRegion id="inqu" title="查询条件">
<div class="row">
<EF:EFDatePicker cname="单据日期" ename="receiptDate" blockId="inqu_status" row="0" colWidth="3"
format="yyyy-MM-dd" readonly="true"/>
<EF:EFInput cname="退货单号" ename="returnNo" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目号" ename="projCode" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="项目名称" ename="projName" blockId="inqu_status" row="0" colWidth="3"/>
</div>
<div class="row">
<EF:EFInput cname="部件名称" ename="inventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFInput cname="零件名称" ename="subInventName" blockId="inqu_status" row="0" colWidth="3"/>
<EF:EFSelect cname="状态" ename="returnStatus" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.returnStatus"/>
</EF:EFSelect>
<EF:EFSelect cname="是否删除" ename="deleteFlag" blockId="inqu_status" row="0" colWidth="3" defaultValue="0">
<EF:EFOption label="全部" value=""/>
<EF:EFCodeOption codeName="hpjx.hpjx.deleteFlag"/>
</EF:EFSelect>
</div>
<div class="row">
<EF:EFDateSpan startCname="创建日期(从)" endCname="至" startName="createdDateFrom" endName="createdDateTo"
blockId="inqu_status" row="0" role="date" format="yyyy-MM-dd" ratio="3:3" satrtRatio="4:8"
endRatio="4:8" readonly="true">
</EF:EFDateSpan>
</div>
</EF:EFRegion>
<EF:EFRegion id="result" title="明细信息">
<EF:EFGrid blockId="result" autoDraw="override" isFloat="true" checkMode="row">
<EF:EFColumn ename="id" cname="内码" hidden="true"/>
<EF:EFColumn ename="operator" cname="操作" locked="true" enable="false" width="100" align="center"/>
<EF:EFColumn ename="returnNo" cname="退货单号" enable="false" width="140" align="center"/>
<EF:EFColumn ename="receiptDate" cname="单据日期" enable="false" width="90" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="projName" cname="项目名称" enable="false" width="140" align="center"/>
<EF:EFComboColumn ename="factoryCode" enable="false" cname="厂区" width="110" align="center" defaultValue=""
filter="contains" readonly="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn>
<EF:EFComboColumn ename="whCode" cname="仓库名称" enable="false" width="120" align="center"
blockName="wh_record_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="inventName" cname="部件名称/存货名称" enable="false" width="150" align="center"/>
<EF:EFColumn ename="subInventName" cname="零件名称" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="inventRecordId" cname="规格" enable="false" width="120" align="center" hidden="true"
blockName="invent_spec_block_id" textField="textField" valueField="valueField"
columnTemplate="#=textField#" itemTemplate="#=textField#">
</EF:EFComboColumn>
<EF:EFColumn ename="length" cname="长(MM)" enable="false" width="100" align="right" format="{0:N3}" hidden="true"/>
<EF:EFColumn ename="width" cname="宽(MM)" enable="false" width="100" align="right" format="{0:N3}" hidden="true"/>
<EF:EFColumn ename="thick" cname="厚(MM)" enable="false" width="100" align="right" format="{0:N3}" hidden="true"/>
<EF:EFColumn ename="amount" cname="数量" enable="false" width="100" align="right" format="{0:N0}"/>
<EF:EFColumn ename="unitWeight" cname="单重(KG)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFColumn ename="weight" cname="总重(T)" enable="false" width="100" align="right" format="{0:N3}"/>
<EF:EFComboColumn ename="returnStatus" cname="状态" width="80" align="center">
<EF:EFCodeOption codeName="hpjx.hpjx.returnStatus"/>
</EF:EFComboColumn
<EF:EFColumn ename="remark" cname="备注" enable="false" width="100" align="center" />
<EF:EFColumn ename="projCode" cname="项目号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="prodNo" cname="生产订单号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="oldSaleNo" cname="原销售单号" enable="false" width="140" align="center" hidden="true"/>
<EF:EFColumn ename="inventCode" cname="部件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="subInventCode" cname="零件编码" enable="false" width="120" align="center" hidden="true"/>
<EF:EFColumn ename="createdName" cname="创建人" enable="false" width="120" align="center"/>
<EF:EFColumn ename="createdTime" cname="创建时间" enable="false" width="140" align="center"
editType="datetime" parseFormats="['yyyyMMddHHmmss','yyyy-MM-dd HH:mm:ss']"/>
</EF:EFGrid>
</EF:EFRegion>
</EF:EFPage>
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