定量设置相关调整

test
anthonywj 1 year ago
parent 21a94967d8
commit af02503996

@ -1,6 +1,7 @@
package com.glxp.api.dao.inv;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.inv.InvProductRationEntity;
import com.glxp.api.req.inv.InvProductRationRequest;
import com.glxp.api.res.inv.InvProductRationResponse;
@ -9,7 +10,7 @@ import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface InvProductRationMapper extends BaseMapper<InvProductRationEntity> {
public interface InvProductRationMapper extends BaseMapperPlus<InvProductRationMapper, InvProductRationEntity, InvProductRationEntity> {
List<InvProductRationResponse> filterList(InvProductRationRequest invProductRationRequest);
}

@ -1,5 +1,6 @@
package com.glxp.api.res.inv;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -114,4 +115,30 @@ public class InvProductRationResponse {
* 1:稿2:
*/
private Integer auditStatus;
private String busInvCode;
private String busOrder;
public String getBusInvCode() {
if (StrUtil.isNotEmpty(busType)) {
switch (busType) {
case "HCLY":
busInvCode = lyInvCode;
break;
case "CPSG":
busInvCode = sgInvCode;
break;
case "CGJH":
busInvCode = jhInvCode;
break;
case "CGDD":
busInvCode = cgInvCode;
break;
default:
break;
}
}
return busInvCode;
}
}

@ -11,7 +11,7 @@ public class PurPlanResponse {
/**
*
*/
private Integer id;
private Long id;
/**
*
*/

@ -1,6 +1,7 @@
package com.glxp.api.service.inv;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.github.pagehelper.PageHelper;
import com.glxp.api.constant.Constant;
@ -87,8 +88,10 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
//2.生成出入库单
Map<String, List<InvProductRationEntity>> inoutList = invProductRationEntities.stream()
.collect(Collectors.groupingBy(item -> item.getScanType()));
.collect(Collectors.groupingBy(item -> StrUtil.trimToEmpty(item.getScanType())));
for (String key : inoutList.keySet()) {
if (StrUtil.isEmpty(key))
continue;
BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(key);
if (bussinessTypeEntity != null) {
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INNOR) {
@ -96,7 +99,7 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
} else if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
Map<String, List<InvProductRationEntity>> listMap = inoutList.get(key).stream()
.collect(Collectors.groupingBy(item -> item.getSupId() + ""));
stringListMap.forEach((supId, rationEntityList) -> {
listMap.forEach((supId, rationEntityList) -> {
genIoOrder(listMap.get(supId), bussinessTypeEntity);
}
);
@ -138,7 +141,7 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
String orderNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.LIN_YONG, "yyyyMMdd"));
purReceiveEntity.setBillNo(orderNo);
purReceiveEntity.setInvCode(curWarehouseEntity.getCode());
purReceiveEntity.setTargetDeptCode(targetWarehouseEntity.getCode());
purReceiveEntity.setTargetInvCode(targetWarehouseEntity.getCode());
purReceiveEntity.setDeptCode(curWarehouseEntity.getParentId());
purReceiveEntity.setTargetDeptCode(targetWarehouseEntity.getParentId());
purReceiveEntity.setRemark("定量不足生成");
@ -162,13 +165,14 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
purReceiveDetailEntity.setSupId(rationEntity.getSupId() + "");
purReceiveDetailEntity.setCount(count);
purReceiveDetailEntities.add(purReceiveDetailEntity);
rationEntity.setBusOrder(orderNo);
}
}
if (CollUtil.isNotEmpty(purReceiveDetailEntities)) {
receiveService.insertOrder(purReceiveEntity);
receivedetailService.saveBatch(purReceiveDetailEntities);
invProductRationEntity.setBusOrder(orderNo);
invProductRationMapper.updateById(invProductRationEntity);
invProductRationMapper.updateBatchById(invProductRationEntities);
}
}
@ -194,9 +198,12 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
purApplyEntity.setBillType(ConstantStatus.BUS_ORDER_CPSG);
purApplyEntity.setStatus(invProductRationEntity.getBusAuditStatus());
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd"));
Long orderId = IdUtil.getSnowflakeNextId();
purApplyEntity.setBillNo(billNo);
purApplyEntity.setId(orderId);
purApplyEntity.setInvCode(curWarehouseEntity.getCode());
purApplyEntity.setTargetDeptCode(targetWarehouseEntity.getCode());
purApplyEntity.setEmergency(1);
purApplyEntity.setTargetInvCode(targetWarehouseEntity.getCode());
purApplyEntity.setDeptCode(curWarehouseEntity.getParentId());
purApplyEntity.setTargetDeptCode(targetWarehouseEntity.getParentId());
purApplyEntity.setRemark("定量不足生成");
@ -215,7 +222,7 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
int count = IntUtil.value(rationEntity.getRationCount()) - IntUtil.value(rationEntity.getInvCount());
if (count > 0) {
PurApplyDetailEntity purApplyDetailEntity = new PurApplyDetailEntity();
purApplyDetailEntity.setOrderIdFk(purApplyEntity.getBillNo());
purApplyDetailEntity.setOrderIdFk(orderId + "");
purApplyDetailEntity.setProductId(rationEntity.getRelId());
UdiRlSupResponse udiRlSupResponse = udiRlSupService.findByRelUnitFk(rationEntity.getRelId() + "", rationEntity.getSupId() + "");
purApplyDetailEntity.setProductName(udiRlSupResponse.getCpmctymc());
@ -223,14 +230,14 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
purApplyDetailEntity.setZczbhhzbapzbh(udiRlSupResponse.getZczbhhzbapzbh());
purApplyDetailEntity.setSupId(rationEntity.getSupId() + "");
purApplyDetailEntities.add(purApplyDetailEntity);
invProductRationEntity.setBusOrder(billNo);
}
}
if (CollUtil.isNotEmpty(purApplyDetailEntities)) {
purApplyService.insert(purApplyEntity);
purApplyDetailService.saveBatch(purApplyDetailEntities);
invProductRationEntity.setBusOrder(billNo);
invProductRationMapper.updateById(invProductRationEntity);
invProductRationMapper.updateBatchById(invProductRationEntities);
}
}
@ -245,7 +252,7 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
public void genJhOrder(List<InvProductRationEntity> invProductRationEntities) {
InvProductRationEntity invProductRationEntity = invProductRationEntities.get(0);
InvWarehouseEntity curWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getCurInvCode());
InvWarehouseEntity targetWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getSgInvCode());
InvWarehouseEntity targetWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getJhInvCode());
PurPlanEntity purPlanEntity = new PurPlanEntity();
purPlanEntity.setCreateUser(invProductRationEntity.getCreateUser());
purPlanEntity.setBillDate(new Date());
@ -255,6 +262,9 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
purPlanEntity.setStatus(invProductRationEntity.getBusAuditStatus());
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd"));
purPlanEntity.setBillNo(billNo);
Long orderId = IdUtil.getSnowflakeNextId();
purPlanEntity.setId(orderId);
purPlanEntity.setEmergency(1);
purPlanEntity.setInvCode(targetWarehouseEntity.getCode());
purPlanEntity.setApplyInv(curWarehouseEntity.getCode());
purPlanEntity.setDeptCode(targetWarehouseEntity.getParentId());
@ -266,7 +276,7 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
int count = IntUtil.value(rationEntity.getRationCount()) - IntUtil.value(rationEntity.getInvCount());
if (count > 0) {
PurPlanDetailEntity purPlanDetailEntity = new PurPlanDetailEntity();
purPlanDetailEntity.setOrderIdFk(purPlanEntity.getBillNo());
purPlanDetailEntity.setOrderIdFk(orderId + "");
purPlanDetailEntity.setProductId(rationEntity.getRelId());
UdiRlSupResponse udiRlSupResponse = udiRlSupService.findByRelUnitFk(rationEntity.getRelId() + "", rationEntity.getSupId() + "");
purPlanDetailEntity.setProductName(udiRlSupResponse.getCpmctymc());
@ -274,11 +284,14 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
purPlanDetailEntity.setZczbhhzbapzbh(udiRlSupResponse.getZczbhhzbapzbh());
purPlanDetailEntity.setSupId(rationEntity.getSupId() + "");
purPlanDetailEntityList.add(purPlanDetailEntity);
invProductRationEntity.setBusOrder(billNo);
}
}
if (CollUtil.isNotEmpty(purPlanDetailEntityList)) {
purPlanService.insert(purPlanEntity);
purPlanDetailService.saveBatch(purPlanDetailEntityList);
invProductRationMapper.updateBatchById(invProductRationEntities);
}
}
@ -298,9 +311,10 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
stringListMap.forEach((key, rationEntityList) -> {
InvProductRationEntity invProductRationEntity = rationEntityList.get(0);
InvWarehouseEntity curWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getCurInvCode());
InvWarehouseEntity targetWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getSgInvCode());
InvWarehouseEntity targetWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getCgInvCode());
PurOrderEntity purOrderEntity = new PurOrderEntity();
purOrderEntity.setCreateUser(invProductRationEntity.getCreateUser());
purOrderEntity.setApplyCreateUser(invProductRationEntity.getCreateUser());
purOrderEntity.setBillDate(new Date());
purOrderEntity.setCreateTime(new Date());
purOrderEntity.setUpdateTime(new Date());
@ -308,11 +322,14 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
purOrderEntity.setStatus(invProductRationEntity.getBusAuditStatus());
String billNo = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.SG_ORDER, "yyyyMMdd"));
purOrderEntity.setBillNo(billNo);
Long orderId = IdUtil.getSnowflakeNextId();
purOrderEntity.setId(orderId);
purOrderEntity.setInvCode(targetWarehouseEntity.getCode());
purOrderEntity.setApplyInv(curWarehouseEntity.getCode());
purOrderEntity.setDeptCode(targetWarehouseEntity.getParentId());
purOrderEntity.setEmergency(1);
purOrderEntity.setSupId(key);
purOrderEntity.setRemark("定量不足生成");
List<PurOrderDetailEntity> purOrderDetailEntities = new ArrayList<>();
//生成单据详情
for (InvProductRationEntity rationEntity : rationEntityList) {
@ -327,7 +344,7 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
int count = IntUtil.value(rationEntity.getRationCount()) - IntUtil.value(rationEntity.getInvCount());
if (count > 0) {
PurOrderDetailEntity purOrderDetailEntity = new PurOrderDetailEntity();
purOrderDetailEntity.setOrderIdFk(purOrderEntity.getBillNo());
purOrderDetailEntity.setOrderIdFk(orderId + "");
purOrderDetailEntity.setProductId(rationEntity.getRelId());
UdiRlSupResponse udiRlSupResponse = udiRlSupService.findByRelUnitFk(rationEntity.getRelId() + "", rationEntity.getSupId() + "");
purOrderDetailEntity.setProductName(udiRlSupResponse.getCpmctymc());
@ -335,13 +352,13 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
purOrderDetailEntity.setZczbhhzbapzbh(udiRlSupResponse.getZczbhhzbapzbh());
purOrderDetailEntity.setSupId(rationEntity.getSupId() + "");
purOrderDetailEntities.add(purOrderDetailEntity);
invProductRationEntity.setBusOrder(billNo);
}
}
if (CollUtil.isNotEmpty(purOrderDetailEntities)) {
purOrderService.insert(purOrderEntity);
purOrderDetailService.saveBatch(purOrderDetailEntities);
invProductRationEntity.setBusOrder(billNo);
invProductRationMapper.updateById(invProductRationEntity);
invProductRationMapper.updateBatchById(invProductRationEntities);
}
}
);
@ -363,7 +380,7 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
IoOrderEntity orderEntity = new IoOrderEntity();
InvWarehouseEntity curWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getCurInvCode());
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INNOR) {
InvWarehouseEntity targetWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getSgInvCode());
InvWarehouseEntity targetWarehouseEntity = invWarehouseService.findByInvSubByCode(invProductRationEntity.getFromInvCode());
orderEntity.setFromInvCode(targetWarehouseEntity.getCode());
orderEntity.setFromDeptCode(targetWarehouseEntity.getParentId());
} else {
@ -419,12 +436,12 @@ public class InvProductRationService extends ServiceImpl<InvProductRationMapper,
orderDetailBizEntity.setSupId(rationEntity.getSupId() + "");
orderDetailBizService.insert(orderDetailBizEntity);
orderDetailBizEntities.add(orderDetailBizEntity);
invProductRationEntity.setScanOrder(orderNo);
}
}
if (CollUtil.isNotEmpty(orderDetailBizEntities)) {
orderService.insertOrder(orderEntity);
invProductRationEntity.setScanOrder(orderNo);
invProductRationMapper.updateById(invProductRationEntity);
invProductRationMapper.updateBatchById(rationEntities);
}
}

@ -89,33 +89,6 @@
</choose>
</select>
<insert id="insert" keyProperty="id" keyColumn="id"
parameterType="com.glxp.api.entity.purchase.PurApplyEntity" useGeneratedKeys="true">
replace
INTO pur_apply
(billNo, billDate, status, billType, remark, invCode,
deptCode, createUser, createTime, auditUser, auditTime, updateTime, updateUser, auditRemark,
targetInvCode, targetDeptCode, planBillNo, generatePlan, emergency, arrivalTime)
values (#{billNo},
#{billDate},
#{status},
#{billType},
#{remark},
#{invCode},
#{deptCode},
#{createUser},
#{createTime},
#{auditUser},
#{auditTime},
#{updateTime},
#{updateUser},
#{auditRemark},
#{targetInvCode},
#{targetDeptCode},
#{planBillNo}, #{generatePlan},
#{emergency}, #{arrivalTime})
</insert>
<delete id="deleteByIds" parameterType="java.util.List">
DELETE

Loading…
Cancel
Save