修改带校验,库存等

dev_unify
yewj 4 months ago
parent f2ebe1872b
commit fb8bbb8b4f

@ -348,7 +348,7 @@ public class IoOrderController extends BaseController {
if (checkInoutService.checkManual(addOrderRequest.getBillNo())) { if (checkInoutService.checkManual(addOrderRequest.getBillNo())) {
if (CollUtil.isNotEmpty(orderDetailBizEntities)) { if (CollUtil.isNotEmpty(orderDetailBizEntities)) {
if (IntUtil.value(bussinessTypeEntity.getCheckWebNewType()) == 3) { if (IntUtil.value(bussinessTypeEntity.getCheckWebNew()) == 3 && IntUtil.value(bussinessTypeEntity.getCheckWebNewType()) == 3) {
String errMsg = checkInoutService.bizOrderCheckPass(orderDetailBizEntities, orderDetailCodeEntities); String errMsg = checkInoutService.bizOrderCheckPass(orderDetailBizEntities, orderDetailCodeEntities);
if (StrUtil.isNotEmpty(errMsg)) { if (StrUtil.isNotEmpty(errMsg)) {
return ResultVOUtils.error(500, errMsg); return ResultVOUtils.error(500, errMsg);

@ -492,6 +492,7 @@ public class BasicBussinessTypeEntity {
/** /**
* 0:1;3, * 0:1;3,
*/ */
@TableField(value = "checkWebNewType")
private int checkWebNewType; private int checkWebNewType;
} }

@ -506,66 +506,69 @@ public class IoCheckInoutService {
} }
String errMsg = ""; String errMsg = "";
//正向校验 BasicBussinessTypeEntity businessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { if (IntUtil.value(businessTypeEntity.getCheckWebNew()) != 3 || IntUtil.value(businessTypeEntity.getCheckWebNewType()) != 3) {
String msg = ""; //正向校验
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) { for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
if (!bizEntity.isCheckSuccess() && !codeEntity.isCheckSuccess() && checkId(bizEntity, codeEntity) == null String msg = "";
&& checkBatchNo(bizEntity, codeEntity) == null for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
&& checkProductDate(bizEntity, codeEntity) == null if (!bizEntity.isCheckSuccess() && !codeEntity.isCheckSuccess() && checkId(bizEntity, codeEntity) == null
&& checkExpireDate(bizEntity, codeEntity) == null && checkBatchNo(bizEntity, codeEntity) == null
) { && checkProductDate(bizEntity, codeEntity) == null
&& checkExpireDate(bizEntity, codeEntity) == null
if (checkCount(bizEntity, codeEntity) == null) { ) {
bizEntity.setCheckSuccess(true);
bizEntity.setScanCount(codeEntity.getReCount()); if (checkCount(bizEntity, codeEntity) == null) {
codeEntity.setCheckSuccess(true); bizEntity.setCheckSuccess(true);
codeEntity.setPrice(bizEntity.getPrice()); bizEntity.setScanCount(codeEntity.getReCount());
} else { codeEntity.setCheckSuccess(true);
bizEntity.setScanCount(codeEntity.getReCount()); codeEntity.setPrice(bizEntity.getPrice());
bizEntity.setCheckSuccess(false); } else {
msg = "数量不匹配"; bizEntity.setScanCount(codeEntity.getReCount());
bizEntity.setCheckSuccess(false);
msg = "数量不匹配";
}
break;
} }
break;
} }
if (StrUtil.isEmpty(msg) && !bizEntity.isCheckSuccess()) {
msg = "三期不匹配";
}
bizEntity.setErrMsg(msg);
} }
if (StrUtil.isEmpty(msg) && !bizEntity.isCheckSuccess()) {
msg = "三期不匹配";
}
bizEntity.setErrMsg(msg);
}
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
if (!bizEntity.isCheckSuccess()) {
errMsg = errMsg + bizEntity.getCoName() + bizEntity.getErrMsg() + ";";
}
}
//反向校验
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
if (!bizEntity.isCheckSuccess() && !codeEntity.isCheckSuccess() && checkId(bizEntity, codeEntity) == null if (!bizEntity.isCheckSuccess()) {
&& checkBatchNo(bizEntity, codeEntity) == null errMsg = errMsg + bizEntity.getCoName() + bizEntity.getErrMsg() + ";";
&& checkProductDate(bizEntity, codeEntity) == null }
&& checkExpireDate(bizEntity, codeEntity) == null }
) {
if (checkCount(bizEntity, codeEntity) == null) { //反向校验
bizEntity.setCheckSuccess(true); for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
codeEntity.setCheckSuccess(true); for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
codeEntity.setPrice(bizEntity.getPrice()); if (!bizEntity.isCheckSuccess() && !codeEntity.isCheckSuccess() && checkId(bizEntity, codeEntity) == null
&& checkBatchNo(bizEntity, codeEntity) == null
&& checkProductDate(bizEntity, codeEntity) == null
&& checkExpireDate(bizEntity, codeEntity) == null
) {
if (checkCount(bizEntity, codeEntity) == null) {
bizEntity.setCheckSuccess(true);
codeEntity.setCheckSuccess(true);
codeEntity.setPrice(bizEntity.getPrice());
}
break;
} }
break;
} }
} }
} for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) {
if (!codeEntity.isCheckSuccess()) {
for (IoOrderDetailCodeEntity codeEntity : orderDetailCodeEntities) { errMsg = errMsg + codeEntity.getCoName() + ";";
if (!codeEntity.isCheckSuccess()) { }
errMsg = errMsg + codeEntity.getCoName() + ";";
} }
} }
if (StrUtil.isNotEmpty(errMsg)) { if (StrUtil.isNotEmpty(errMsg)) {
orderEntity.setErrMsg(errMsg + "校验失败"); orderEntity.setErrMsg(errMsg + "校验失败");
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK_FAIL); orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK_FAIL);
@ -726,7 +729,7 @@ public class IoCheckInoutService {
codeEntity.setCheckSuccess(false); codeEntity.setCheckSuccess(false);
} }
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
bizEntity.setCheckSuccess(false); bizEntity.setCheckSuccess(true);
} }
for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) {
String msg = ""; String msg = "";

@ -53,7 +53,7 @@ public class IoGenInvService {
public void genNorInv(String orderId) { public void genNorInv(String orderId) {
IoOrderEntity orderEntity = orderService.findByBillNo(orderId); IoOrderEntity orderEntity = orderService.findByBillNo(orderId);
List<IoOrderDetailResultEntity> orderDetailResultEntities = orderDetailResultService.findByOrderId(orderId); List<IoOrderDetailResultEntity> orderDetailResultEntities = orderDetailResultService.findByOrderId(orderId);
List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderId); // List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderId);
//补齐单据信息 //补齐单据信息
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction());
@ -84,9 +84,9 @@ public class IoGenInvService {
} }
if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) { if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
invProductEntity.setOutCount(invProductEntity.getOutCount() + orderDetailResultEntity.getReCount()); invProductEntity.setOutCount(invProductEntity.getOutCount() + orderDetailResultEntity.getCount());
} else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { } else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
invProductEntity.setInCount(invProductEntity.getInCount() + orderDetailResultEntity.getReCount()); invProductEntity.setInCount(invProductEntity.getInCount() + orderDetailResultEntity.getCount());
} }
invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount()); invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount());
invProductEntity.setUpdateTime(new Date()); invProductEntity.setUpdateTime(new Date());

@ -10,34 +10,33 @@
bp.cpmctymc, bp.cpmctymc,
bp.measname, bp.measname,
ip.relIdFk, ip.relIdFk,
COALESCE(bp.ggxh,bp.bzgg) as ggxh, COALESCE(bp.ggxh, bp.bzgg) as ggxh,
ip.batchNo, ip.batchNo,
ip.productionDate, ip.productionDate,
ip.expireDate, ip.expireDate,
COALESCE(bp.ylqxzcrbarmc,bp.manufactory) as ylqxzcrbarmc, COALESCE(bp.ylqxzcrbarmc, bp.manufactory) as ylqxzcrbarmc,
bp.zczbhhzbapzbh, bp.zczbhhzbapzbh,
bp.packUnit, bp.packUnit,
bp.prepnUnit, bp.prepnUnit,
bp.prepnSpec, bp.prepnSpec,
sum(ip.inCount) as inCount, inCount,
sum(ip.outCount) as outCount, outCount,
sum(ip.reCount) as reCount, reCount,
ip.customerId, ip.customerId,
basic_corp.name supName, basic_corp.name supName,
ip.supId, ip.supId,
auth_dept.name deptName, auth_dept.name deptName,
auth_warehouse.name invName, auth_warehouse.name invName,
ip.deptCode, ip.deptCode,
ip.invCode, ip.invCode,
s.name spaceName, s.name spaceName,
ip.price ip.price
from inv_product ip from inv_product ip
inner join basic_udirel on ip.relIdFk = basic_udirel.id INNER JOIN basic_products bp ON ip.relIdFk = (SELECT id FROM basic_udirel WHERE uuid = bp.uuid)
inner join basic_products bp on basic_udirel.uuid = bp.uuid LEFT JOIN basic_corp ON ip.supId = basic_corp.erpId
left join basic_corp on ip.supId = basic_corp.erpId LEFT JOIN auth_dept ON auth_dept.CODE = ip.deptCode
left join auth_dept on auth_dept.code = ip.deptCode LEFT JOIN auth_warehouse ON auth_warehouse.CODE = ip.invCode
left join auth_warehouse on auth_warehouse.code = ip.invCode LEFT JOIN auth_space s ON ip.invSpaceCode = s.CODE
left join auth_space s on ip.invSpaceCode = s.code
<where> <where>
bp.diType = 1 bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">
@ -54,8 +53,8 @@
</if> </if>
<if test="ggxh != null and ggxh != ''"> <if test="ggxh != null and ggxh != ''">
AND ( AND (
bp.ggxh like concat('%', #{ggxh}, '%') bp.ggxh like concat('%', #{ggxh}, '%')
or bp.bzgg like concat('%', #{ggxh}, '%')) or bp.bzgg like concat('%', #{ggxh}, '%'))
</if> </if>
<if test="batchNo != null and batchNo != ''"> <if test="batchNo != null and batchNo != ''">
AND ip.batchNo like concat('%', #{batchNo}, '%') AND ip.batchNo like concat('%', #{batchNo}, '%')
@ -68,8 +67,8 @@
</if> </if>
<if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''"> <if test="ylqxzcrbarmc != null and ylqxzcrbarmc != ''">
AND ( AND (
bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%') bp.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
or bp.manufactory like concat('%', #{ylqxzcrbarmc}, '%')) or bp.manufactory like concat('%', #{ylqxzcrbarmc}, '%'))
</if> </if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''"> <if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%') AND bp.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
@ -109,14 +108,14 @@
</if> </if>
<if test="keyWords != '' and keyWords != null"> <if test="keyWords != '' and keyWords != null">
AND ( AND (
bp.nameCode like concat('%', #{keyWords}, '%') bp.nameCode like concat('%', #{keyWords}, '%')
or bp.cpmctymc like concat('%', #{keyWords}, '%') or bp.cpmctymc like concat('%', #{keyWords}, '%')
or bp.bzgg like concat('%', #{keyWords}, '%') or bp.bzgg like concat('%', #{keyWords}, '%')
or bp.ggxh like concat('%', #{keyWords}, '%') or bp.ggxh like concat('%', #{keyWords}, '%')
or ip.batchNo like concat('%', #{keyWords}, '%') or ip.batchNo like concat('%', #{keyWords}, '%')
or bp.prepnSpec like concat('%', #{keyWords}, '%') or bp.prepnSpec like concat('%', #{keyWords}, '%')
or bp.ylqxzcrbarmc like concat('%', #{keyWords}, '%') or bp.ylqxzcrbarmc like concat('%', #{keyWords}, '%')
or bp.manufactory LIKE concat('%', #{keyWords}, '%')) or bp.manufactory LIKE concat('%', #{keyWords}, '%'))
</if> </if>
</where> </where>
GROUP BY ip.relIdFk, ip.batchNo, ip.supId, ip.price GROUP BY ip.relIdFk, ip.batchNo, ip.supId, ip.price
@ -141,10 +140,10 @@
sum(ip.outCount) outCount, sum(ip.outCount) outCount,
sum(ip.reCount) reCount sum(ip.reCount) reCount
from inv_product ip from inv_product ip
inner join basic_udirel bu on ip.relIdFk = bu.id inner join basic_udirel bu on ip.relIdFk = bu.id
inner join basic_products bp on bu.uuid = bp.uuid inner join basic_products bp on bu.uuid = bp.uuid
left join basic_corp bc on ip.supId = bc.erpId left join basic_corp bc on ip.supId = bc.erpId
left join auth_warehouse aw on aw.code = ip.invCode left join auth_warehouse aw on aw.code = ip.invCode
<where> <where>
bp.diType = 1 bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">
@ -184,11 +183,11 @@
<select id="getMAInvProducts" resultType="com.glxp.api.res.inv.InvProductResponse"> <select id="getMAInvProducts" resultType="com.glxp.api.res.inv.InvProductResponse">
select ip.id, bp.nameCode, bp.cpmctymc, bp.ggxh, ip.batchNo, ip.productionDate, ip.expireDate select ip.id, bp.nameCode, bp.cpmctymc, bp.ggxh, ip.batchNo, ip.productionDate, ip.expireDate
from inv_product ip from inv_product ip
left join inv_product_detail ipd left join inv_product_detail ipd
on ip.relIdFk = ipd.relId and on ip.relIdFk = ipd.relId and
ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
left join basic_udirel bu on bu.id = ip.relIdFk left join basic_udirel bu on bu.id = ip.relIdFk
left join basic_products bp on bu.uuid = bp.uuid left join basic_products bp on bu.uuid = bp.uuid
<where> <where>
(inCount - outCount) > 0 (inCount - outCount) > 0
<if test="nameCode != null and nameCode != ''"> <if test="nameCode != null and nameCode != ''">
@ -216,10 +215,10 @@
<select id="selectProductInfo" resultType="com.glxp.api.entity.inv.InvProductEntity"> <select id="selectProductInfo" resultType="com.glxp.api.entity.inv.InvProductEntity">
select ip.* select ip.*
from inv_product ip from inv_product ip
left join inv_product_detail ipd on ip.relIdFk = ipd.relId left join inv_product_detail ipd on ip.relIdFk = ipd.relId
and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
and ip.deptCode = ipd.deptCode and ip.deptCode = ipd.deptCode
and ip.invCode = ipd.invCode and ip.invCode = ipd.invCode
<where> <where>
<if test="relId != null and relId != ''"> <if test="relId != null and relId != ''">
AND ip.relIdFk = #{relId} AND ip.relIdFk = #{relId}
@ -252,11 +251,11 @@
sum(inv_product.inCount - inv_product.outCount) reCount, sum(inv_product.inCount - inv_product.outCount) reCount,
basic_products.cpmctymc basic_products.cpmctymc
from inv_product_detail from inv_product_detail
left join inv_product on inv_product_detail.relId = inv_product.relIdFk left join inv_product on inv_product_detail.relId = inv_product.relIdFk
and inv_product.invCode = inv_product_detail.invCode and inv_product.invCode = inv_product_detail.invCode
AND IFNULL(inv_product.batchNo, 'empty') = IFNULL(inv_product_detail.batchNo, 'empty') AND IFNULL(inv_product.batchNo, 'empty') = IFNULL(inv_product_detail.batchNo, 'empty')
left join basic_udirel on inv_product_detail.relId = basic_udirel.id left join basic_udirel on inv_product_detail.relId = basic_udirel.id
left join basic_products on basic_products.uuid = basic_udirel.uuid left join basic_products on basic_products.uuid = basic_udirel.uuid
<where> <where>
<if test="invCode != null and invCode != ''"> <if test="invCode != null and invCode != ''">
AND inv_product_detail.invCode = #{invCode} AND inv_product_detail.invCode = #{invCode}
@ -290,8 +289,8 @@
ip.outCount, ip.outCount,
ip.reCount ip.reCount
from inv_product ip from inv_product ip
left join inv_product_detail ipd left join inv_product_detail ipd
on ip.relIdFk = ipd.relId and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') on ip.relIdFk = ipd.relId and ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
<where> <where>
<if test="invCode != null and invCode != ''"> <if test="invCode != null and invCode != ''">
AND ip.invCode = #{invCode} AND ip.invCode = #{invCode}
@ -309,10 +308,10 @@
<select id="filterProductNames" resultType="com.glxp.api.res.inv.InvProductResponse"> <select id="filterProductNames" resultType="com.glxp.api.res.inv.InvProductResponse">
select ip.relIdFk, bp.cpmctymc, bp.ggxh select ip.relIdFk, bp.cpmctymc, bp.ggxh
from inv_product ip from inv_product ip
left join inv_product_detail ipd on ip.relIdFk = ipd.relId and ip.invCode = ipd.invCode and left join inv_product_detail ipd on ip.relIdFk = ipd.relId and ip.invCode = ipd.invCode and
ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
left join basic_udirel bu on bu.id = ip.relIdFk left join basic_udirel bu on bu.id = ip.relIdFk
left join basic_products bp on bp.uuid = bu.uuid left join basic_products bp on bp.uuid = bu.uuid
<where> <where>
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">
AND bp.cpmctymc like concat('%', #{cpmctymc}, '%') AND bp.cpmctymc like concat('%', #{cpmctymc}, '%')
@ -350,13 +349,13 @@
ip.deptCode, ip.deptCode,
ip.invCode ip.invCode
from inv_product ip from inv_product ip
inner join basic_udirel on ip.relIdFk = basic_udirel.id inner join basic_udirel on ip.relIdFk = basic_udirel.id
inner join basic_products bp on basic_udirel.uuid = bp.uuid inner join basic_products bp on basic_udirel.uuid = bp.uuid
left join basic_corp on ip.supId = basic_corp.erpId left join basic_corp on ip.supId = basic_corp.erpId
left join auth_dept on auth_dept.code = ip.deptCode left join auth_dept on auth_dept.code = ip.deptCode
left join auth_warehouse on auth_warehouse.code = ip.invCode left join auth_warehouse on auth_warehouse.code = ip.invCode
left join inv_product_detail ipd on ip.invCode = ipd.invCode and ip.relIdFk = ipd.relId and left join inv_product_detail ipd on ip.invCode = ipd.invCode and ip.relIdFk = ipd.relId and
ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty') ifnull(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
<where> <where>
bp.diType = 1 bp.diType = 1
<if test="cpmctymc != null and cpmctymc != ''"> <if test="cpmctymc != null and cpmctymc != ''">

Loading…
Cancel
Save