rev : 出库分配

This commit is contained in:
2023-05-25 20:38:18 +08:00
parent f530e6d7b4
commit 65822e1864
37 changed files with 797 additions and 219 deletions

View File

@@ -1,5 +1,6 @@
package org.nl.wms.masterdata_manage.service.master.dao;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -27,6 +28,7 @@ public class MdPbMeasureunit implements Serializable {
/**
* 计量单位标识
*/
@TableId
private String measure_unit_id;
/**

View File

@@ -1,8 +1,19 @@
package org.nl.wms.mps_manage.ordermanage.controller.saleOrder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.IMpsSaleOrderService;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dto.OrderQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
@@ -14,8 +25,21 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2023-05-25
*/
@RestController
@RequestMapping("/mpsSaleOrder")
@RequiredArgsConstructor
@Api(tags = "生产订单")
@Slf4j
@RequestMapping("/api/mpsSaleOrder")
public class MpsSaleOrderController {
@Autowired
private IMpsSaleOrderService iMpsSaleOrderService;
@GetMapping
@Log("查询生产订单")
@ApiOperation("查询生产订单")
public ResponseEntity<Object> query(OrderQuery query, PageQuery page){
return new ResponseEntity<>(iMpsSaleOrderService.pageQuery(query,page), HttpStatus.OK);
}
}

View File

@@ -1,7 +1,9 @@
package org.nl.wms.mps_manage.ordermanage.service.saleOrder;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.MpsSaleOrder;
import org.nl.common.domain.query.PageQuery;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.MpsSaleOrder;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dto.OrderQuery;
/**
* <p>
@@ -13,4 +15,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IMpsSaleOrderService extends IService<MpsSaleOrder> {
/**
* 分页查询
* @param query,page /
* @return JSONObject
*/
Object pageQuery(OrderQuery query, PageQuery page);
}

View File

@@ -1,7 +1,13 @@
package org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.mapper;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.MpsSaleOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.MpsSaleOrder;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dto.OrderQuery;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +19,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface MpsSaleOrderMapper extends BaseMapper<MpsSaleOrder> {
List<Map> pageQuery(@Param("query") OrderQuery query, @Param("pageQuery") PageQuery pageQuery);
}

View File

@@ -2,4 +2,35 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.mapper.MpsSaleOrderMapper">
<select id="pageQuery" resultType="java.util.Map">
SELECT
der.*,
mater.material_code,
mater.material_name,
unit.unit_name AS qty_unit_name
FROM
mps_sale_order der
LEFT JOIN md_me_materialbase mater ON der.material_id = mater.material_id
LEFT JOIN md_pb_measureunit unit ON der.qty_unit_id = unit.measure_unit_id
<where>
der.is_delete = '0'
<if test="query.sale_code != null">
and der.sale_code = #{query.sale_code}
</if>
<if test="query.status != null">
and der.status >= #{query.status}
</if>
<if test="query.sale_type != null">
and der.sale_type >= #{query.sale_type}
</if>
<if test="query.cust_code != null">
and der.cust_code >= #{query.cust_code}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,34 @@
package org.nl.wms.mps_manage.ordermanage.service.saleOrder.dto;
import lombok.Data;
import org.nl.common.domain.query.BaseQuery;
import org.nl.common.domain.query.QParam;
import org.nl.common.enums.QueryTEnum;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.MpsSaleOrder;
/*
* @author ZZQ
* @Date 2023/5/4 19:49
*/
@Data
public class OrderQuery extends BaseQuery<MpsSaleOrder> {
private String sale_code;
private String status;
private String sale_type;
private String cust_code;
private Boolean is_delete = false;
@Override
public void paramMapping() {
super.doP.put("sale_code", QParam.builder().k(new String[]{"sale_code"}).type(QueryTEnum.LK).build());
}
}

View File

@@ -1,11 +1,19 @@
package org.nl.wms.mps_manage.ordermanage.service.saleOrder.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.IMpsSaleOrderService;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.MpsSaleOrder;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dao.mapper.MpsSaleOrderMapper;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.IMpsSaleOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.wms.mps_manage.ordermanage.service.saleOrder.dto.OrderQuery;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 生产订单表 服务实现类
@@ -17,4 +25,12 @@ import org.springframework.stereotype.Service;
@Service
public class MpsSaleOrderServiceImpl extends ServiceImpl<MpsSaleOrderMapper, MpsSaleOrder> implements IMpsSaleOrderService {
@Override
public Object pageQuery(OrderQuery query, PageQuery pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
List<Map> mst_detail = baseMapper.pageQuery(query, pageQuery);
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
build.setTotalElements(page.getTotal());
return build;
}
}

View File

@@ -70,5 +70,13 @@ public class IStivtlostorivnCpOutController {
return new ResponseEntity<>(iStIvtIostorinvCpOutService.getIosInvDis(whereJson),HttpStatus.OK);
}
@PostMapping("/allDivIvt")
@Log("全部分配")
@ApiOperation("全部分配")
public ResponseEntity<Object> allDivIvt(@RequestBody JSONObject whereJson){
iStIvtIostorinvCpOutService.allDivIvt(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -1,6 +1,18 @@
package org.nl.wms.storage_manage.productmanage.controller.moreOrLess;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIfDeliveryorderCpService;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dto.DeliveQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -13,8 +25,21 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2023-05-04
*/
@RestController
@RequestMapping("/stIfDeliveryorderCp")
@RequiredArgsConstructor
@Api(tags = "销售发货单")
@Slf4j
@RequestMapping("/api/stIfDeliveryorderCp")
public class StIfDeliveryorderCpController {
@Autowired
private IStIfDeliveryorderCpService iStIfDeliveryorderCpService;
@GetMapping
@Log("查询生产订单")
@ApiOperation("查询生产订单")
public ResponseEntity<Object> query(DeliveQuery query, PageQuery page){
return new ResponseEntity<>(iStIfDeliveryorderCpService.pageQuery(query,page), HttpStatus.OK);
}
}

View File

@@ -83,4 +83,15 @@ public interface IStIvtIostorinvCpOutService extends IService<StIvtIostorinvCp>
*/
void delete(Long[] ids);
/**
* 全部分配
* @param whereJson
* {
* iostorinv_id : 主表标识,
* iostorinvdtl_id : 明细标识,
* stor_id : 仓库标识,
* sect_id : 库区标识
* }
*/
void allDivIvt(JSONObject whereJson);
}

View File

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdtlCp;
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
import java.util.Collection;
import java.util.List;
@@ -24,7 +25,29 @@ public interface IStIvtIostorinvdisCpService extends IService<StIvtIostorinvdisC
*/
void batchInsert(Collection<StIvtIostorinvdisCp> list);
/**
* 查找入库分配
* @param map /
*/
List<Map> queryInvDisByInvdtl(Map<String, Object> map);
/**
* 查找出库分配
* @param map /
*/
List<Map> queryInvDisByInvOutdtl(Map<String, Object> map);
/**
* 入库分配处理方法
* @param list /
* @param json /
*/
List<StIvtIostorinvdisCp> onductDataDis(List<JSONObject> list, JSONObject json);
/**
* 出库分配处理方法
* @param list /
* @param dtlDao /
*/
void onductDataOutDis(List<StIvtStructivtCp> list, StIvtIostorinvdtlCp dtlDao);
}

View File

@@ -22,4 +22,7 @@ public interface StIvtIostorinvdisCpMapper extends BaseMapper<StIvtIostorinvdisC
List<Map> queryInvDisByInvdtl(Map<String,Object> map);
List<Map> queryInvDisByInvOutdtl(Map<String,Object> map);
}

View File

@@ -65,6 +65,7 @@
#{item.point_name})
</foreach>
</insert>
<select id="queryInvDisByInvdtl" resultType="java.util.Map">
SELECT
dis.*,
@@ -91,4 +92,23 @@
</if>
order by dis.seq_no ASC
</select>
<select id="queryInvDisByInvOutdtl" resultType="java.util.Map">
SELECT
dis.*,
mater.material_code,
mater.material_name,
mater.material_spec
FROM
st_ivt_iostorinvdis_cp dis
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
WHERE 1=1
<if test="iostorinvdtl_id != null and iostorinvdtl_id != ''">
and dis.iostorinvdtl_id = #{iostorinvdtl_id}
</if>
<if test="iostorinv_id != null and iostorinv_id != ''">
and dis.iostorinv_id = #{iostorinv_id}
</if>
order by dis.seq_no ASC
</select>
</mapper>

View File

@@ -3,18 +3,14 @@ package org.nl.wms.storage_manage.productmanage.service.iostorInv.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.jsonwebtoken.lang.Assert;
import org.jetbrains.annotations.NotNull;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.publish.BussEventMulticaster;
import org.nl.common.publish.event.PointEvent;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
@@ -22,28 +18,23 @@ import org.nl.modules.system.util.CodeUtil;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbBucketrecordService;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleextService;
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleinfoService;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleext;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleinfo;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtBsrealstorattr;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.product_manage.sch.manage.TaskStatusEnum;
import org.nl.wms.scheduler_manage.service.point.ISchBasePointService;
import org.nl.wms.scheduler_manage.service.point.dao.SchBasePoint;
import org.nl.wms.scheduler_manage.service.task.ISchBaseTaskService;
import org.nl.wms.scheduler_manage.service.task.dao.SchBaseTask;
import org.nl.wms.storage_manage.CHANGE_BILL_TYPE_ENUM;
import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.*;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvCpOutService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisCpService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisdtlCpService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdtlCpService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisdtlCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdtlCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.mapper.StIvtIostorinvCpMapper;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dto.IostorInvQuery;
import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService;
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
import org.nl.wms.storage_manage.productmanage.util.ChangeIvtUtil;
import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService;
import org.nl.wms.storage_manage.productmanage.util.RuleUtil;
@@ -52,11 +43,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.stream.Collectors;
/**
* <p>
@@ -162,7 +152,7 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
public List getIosInvDis(JSONObject whereJson) {
// 查询分配表
List<Map> maps = iostorinvdisCpService.queryInvDisByInvdtl(whereJson);
List<Map> maps = iostorinvdisCpService.queryInvDisByInvOutdtl(whereJson);
return maps;
}
@@ -179,6 +169,73 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void allDivIvt(JSONObject whereJson) {
/*
* 1.查找出所有需要分配的明细
* 2.找到对应库存
* 3.插入分配表
* 4.更新库存冻结数
* 5.更新仓位为锁定
* 6.更新明细状态
* 7.更新主表状态
*/
StIvtIostorinvCp mstDao = this.getById(whereJson.getString("iostorinv_id"));
// 1.查找出所有需要分配的明细
List<StIvtIostorinvdtlCp> dtlDaoList = iostorinvdtlCpService.list(
new QueryWrapper<StIvtIostorinvdtlCp>().lambda()
.eq(StIvtIostorinvdtlCp::getIostorinv_id, whereJson.getString("iostorinv_id"))
.orderByAsc(StIvtIostorinvdtlCp::getSeq_no)
);
// 2.找库存
for (StIvtIostorinvdtlCp dtlDao : dtlDaoList) {
double unassign_qty = dtlDao.getUnassign_qty().doubleValue();
JSONObject param = new JSONObject();
param.put("stor_id", whereJson.getString("stor_id"));
param.put("sect_id", whereJson.getString("sect_id"));
param.put("material_id", dtlDao.getMaterial_id());
param.put("sale_id", dtlDao.getSource_billdtl_id());
param.put("rule_type", RuleUtil.PRODUCTION_OUT_1);
List<StIvtStructivtCp> ivtList = new ArrayList<>(); // 需要更新库存、仓位、插入分配明细的集合
while (unassign_qty > 0) {
StIvtStructivtCp ivtDao = divRuleCpService.divRuleOut(param);
if (ObjectUtil.isEmpty(ivtDao)) throw new BadRequestException("库存不足");
// 更新未分配数
unassign_qty = NumberUtil.sub(unassign_qty,ivtDao.getCanuse_qty().doubleValue());
ivtList.add(ivtDao);
}
// 3.插入分配表
iostorinvdisCpService.onductDataOutDis(ivtList,dtlDao);
// 4.更新明细状态
BigDecimal assign_qty = ivtList.stream()
.map(StIvtStructivtCp::getCanuse_qty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
dtlDao.setUnassign_qty(BigDecimal.valueOf(0));
dtlDao.setAssign_qty(assign_qty);
iostorinvdtlCpService.updateById(dtlDao);
// 5.更新库存冻结数 、 锁定仓位
updateIvt(ivtList,mstDao);
// 6.更新主表
updateMst(mstDao.getIostorinv_id());
}
}
@NotNull
private StIvtIostorinvCp packageMstForm(StIvtIostorinvCp stIvtIostorinvCp,JSONObject whereJson,Boolean isUpdate) {
@@ -272,4 +329,34 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
this.updateById(mstDao);
}
private void updateIvt(List<StIvtStructivtCp> ivtList,StIvtIostorinvCp mstDao) {
/*
更新库存冻结数
*/
for (StIvtStructivtCp ivtDao : ivtList) {
// 1.更新库存
JSONObject param = new JSONObject();
param.put("struct_id", ivtDao.getStruct_id());
param.put("material_id", ivtDao.getMaterial_id());
param.put("pcsn", ivtDao.getPcsn());
param.put("ivt_level", ivtDao.getIvt_level());
param.put("quality_scode", ivtDao.getQuality_scode());
param.put("change_qty", ivtDao.getCanuse_qty());
param.put("sale_id", ivtDao.getSale_id());
param.put("change_type", ChangeIvtUtil.ADDFROZEN_SUBIVT_QTY);
iStIvtStructivtCpService.UpdateIvt(param);
// 2.锁定仓位
iStIvtStructattrService.update(
new StIvtStructattr()
.setLock_type("01") // TODO 暂时写死
.setInv_id(mstDao.getIostorinv_id())
.setInv_type(mstDao.getBill_type())
.setInv_code(mstDao.getBill_code()),
new QueryWrapper<StIvtStructattr>().lambda()
.eq(StIvtStructattr::getStruct_id, ivtDao.getStruct_id())
);
}
}
}

View File

@@ -361,7 +361,7 @@ public class StIvtIostorinvCpServiceImpl extends ServiceImpl<StIvtIostorinvCpMap
if (ObjectUtil.isEmpty(struct_id)) {
/* 自动分配 */
whereJson.put("rule_type", RuleUtil.PRODUCTION_IN);
whereJson.put("rule_type", RuleUtil.PRODUCTION_IN_1);
attrDao = divRuleCpService.divRuleIn(whereJson);
} else {

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.common.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.masterdata_manage.service.master.IMdPbMeasureunitService;
import org.nl.wms.masterdata_manage.service.master.dao.MdPbMeasureunit;
@@ -13,9 +14,13 @@ import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleextServic
import org.nl.wms.masterdata_manage.service.vehicle.IMdPbStoragevehicleinfoService;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleext;
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbStoragevehicleinfo;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisCpService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdisCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.StIvtIostorinvdtlCp;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.dao.mapper.StIvtIostorinvdisCpMapper;
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -45,6 +50,9 @@ public class StIvtIostorinvdisCpServiceImpl extends ServiceImpl<StIvtIostorinvdi
@Autowired
protected IMdPbMeasureunitService iMdPbMeasureunitService; // 计量单位表服务
@Autowired
protected IStIvtStructattrService iStIvtStructattrService; // 仓位属性服务
@Override
public void batchInsert(Collection<StIvtIostorinvdisCp> list) {
if (!CollectionUtils.isEmpty(list)){
@@ -57,6 +65,11 @@ public class StIvtIostorinvdisCpServiceImpl extends ServiceImpl<StIvtIostorinvdi
return baseMapper.queryInvDisByInvdtl(map);
}
@Override
public List<Map> queryInvDisByInvOutdtl(Map<String, Object> map) {
return baseMapper.queryInvDisByInvOutdtl(map);
}
@Override
public List<StIvtIostorinvdisCp> onductDataDis(List<JSONObject> list, JSONObject json) {
List<StIvtIostorinvdisCp> result = new ArrayList<>();
@@ -113,4 +126,42 @@ public class StIvtIostorinvdisCpServiceImpl extends ServiceImpl<StIvtIostorinvdi
});
return result;
}
@Override
public void onductDataOutDis(List<StIvtStructivtCp> list, StIvtIostorinvdtlCp dtlDao) {
for (StIvtStructivtCp ivtDao : list) {
StIvtStructattr attrDao = iStIvtStructattrService.getById(ivtDao.getStruct_id());
MdPbMeasureunit untiDao = iMdPbMeasureunitService.getById(ivtDao.getQty_unit_id());
StIvtIostorinvdisCp disDao = new StIvtIostorinvdisCp()
.setIostorinvdis_id(IdUtil.getStringId())
.setIostorinvdtl_id(dtlDao.getIostorinvdtl_id())
.setIostorinv_id(dtlDao.getIostorinv_id())
.setSeq_no(1)
.setSect_id(attrDao.getSect_id())
.setSect_code(attrDao.getSect_code())
.setSect_name(attrDao.getSect_name())
.setStruct_id(attrDao.getStruct_id())
.setStruct_code(attrDao.getStruct_code())
.setStruct_name(attrDao.getStruct_name())
.setMaterial_id(ivtDao.getMaterial_id())
.setPcsn(ivtDao.getPcsn())
.setQuality_scode(ivtDao.getQuality_scode()) // TODO 暂时写
.setIvt_level(ivtDao.getIvt_level()) // TODO 暂时写
.setIs_active(true)
.setWork_status("00") // TODO 暂时写
.setStoragevehicle_code(attrDao.getStoragevehicle_code())
.setIs_issued(false)
.setQty_unit_id(untiDao.getMeasure_unit_id())
.setQty_unit_name(untiDao.getUnit_name())
.setPlan_qty(ivtDao.getCanuse_qty())
.setReal_qty(ivtDao.getCanuse_qty());
this.save(disDao);
}
}
}

View File

@@ -2,11 +2,13 @@ package org.nl.wms.storage_manage.productmanage.service.iostorInv.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.nl.wms.masterdata_manage.service.master.IMdPbMeasureunitService;
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
import org.nl.wms.storage_manage.IOSEnum;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdisCpService;
import org.nl.wms.storage_manage.productmanage.service.iostorInv.IStIvtIostorinvdtlCpService;
@@ -62,8 +64,15 @@ public class StIvtIostorinvdtlCpServiceImpl extends ServiceImpl<StIvtIostorinvdt
this.remove(new QueryWrapper<StIvtIostorinvdtlCp>().eq("iostorinv_id", iostorinvCp_id));
for (int i = 0; i < rows.size(); i++) {
JSONObject json = rows.getJSONObject(i);
StIvtIostorinvdtlCp row = rows.getJSONObject(i).toJavaObject(StIvtIostorinvdtlCp.class);
MdMeMaterialbase materDao = materialbaseService.getOne(
new QueryWrapper<MdMeMaterialbase>().lambda()
.eq(MdMeMaterialbase::getMaterial_code, json.getString("material_code"))
);
row.setIostorinv_id(iostorinvCp_id);
row.setMaterial_id(materDao.getMaterial_id());
row.setIostorinvdtl_id(org.nl.common.utils.IdUtil.getStringId());
row.setSeq_no(i+1);
row.setPcsn(DateUtil.today());

View File

@@ -1,7 +1,9 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIfDeliveryorderCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dto.DeliveQuery;
/**
* <p>
@@ -13,4 +15,6 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIfDelive
*/
public interface IStIfDeliveryorderCpService extends IService<StIfDeliveryorderCp> {
Object pageQuery(DeliveQuery query, PageQuery page);
}

View File

@@ -1,7 +1,13 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIfDeliveryorderCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dto.DeliveQuery;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +19,6 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIfDelive
*/
public interface StIfDeliveryorderCpMapper extends BaseMapper<StIfDeliveryorderCp> {
List<Map> pageQuery(@Param("query") DeliveQuery query, @Param("pageQuery") PageQuery pageQuery);
}

View File

@@ -2,4 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIfDeliveryorderCpMapper">
<select id="pageQuery" resultType="java.util.Map">
SELECT
der.*,
mater.material_name,
unit.unit_name AS qty_unit_name
FROM
ST_IF_DeliveryOrder_CP der
LEFT JOIN md_me_materialbase mater ON der.material_id = mater.material_id
LEFT JOIN md_pb_measureunit unit ON der.qty_unit_id = unit.measure_unit_id
<where>
1 = 1
<if test="query.deliver_code != null">
and der.deliver_code = #{query.deliver_code}
</if>
<if test="query.material_code != null">
and der.material_code >= #{query.material_code}
</if>
<if test="query.status != null">
and der.status >= #{query.status}
</if>
<if test="query.cust_code != null">
and der.cust_code >= #{query.cust_code}
</if>
<if test="query.sale_code != null">
and der.sale_code >= #{query.sale_code}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,33 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.dto;
import lombok.Data;
import org.nl.common.domain.query.BaseQuery;
import org.nl.common.domain.query.QParam;
import org.nl.common.enums.QueryTEnum;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIfDeliveryorderCp;
/*
* @author ZZQ
* @Date 2023/5/4 19:49
*/
@Data
public class DeliveQuery extends BaseQuery<StIfDeliveryorderCp> {
private String deliver_code;
private String material_code;
private String status;
private String cust_code;
private String sale_code;
@Override
public void paramMapping() {
super.doP.put("deliver_code", QParam.builder().k(new String[]{"deliver_code"}).type(QueryTEnum.LK).build());
}
}

View File

@@ -1,11 +1,19 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.nl.common.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIfDeliveryorderCpService;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIfDeliveryorderCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIfDeliveryorderCpMapper;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dto.DeliveQuery;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* <p>
* 销售发货单表 服务实现类
@@ -17,4 +25,12 @@ import org.springframework.stereotype.Service;
@Service
public class StIfDeliveryorderCpServiceImpl extends ServiceImpl<StIfDeliveryorderCpMapper, StIfDeliveryorderCp> implements IStIfDeliveryorderCpService {
@Override
public Object pageQuery(DeliveQuery query, PageQuery pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
List<Map> mst_detail = baseMapper.pageQuery(query, pageQuery);
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
build.setTotalElements(page.getTotal());
return build;
}
}

View File

@@ -30,4 +30,11 @@ public interface IStIvtStructivtCpService extends IService<StIvtStructivtCp> {
*/
void UpdateIvt(JSONObject json);
/**
* 获取一个库存
* @param json /
* @return StIvtStructivtCp
*/
StIvtStructivtCp queryIvtOutOne(JSONObject json);
}

View File

@@ -1,5 +1,6 @@
package org.nl.wms.storage_manage.productmanage.service.structIvt.dao.mapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
@@ -13,4 +14,6 @@ import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStruct
*/
public interface StIvtStructivtCpMapper extends BaseMapper<StIvtStructivtCp> {
StIvtStructivtCp queryIvtOutOne(JSONObject json);
}

View File

@@ -2,4 +2,28 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.nl.wms.storage_manage.productmanage.service.structIvt.dao.mapper.StIvtStructivtCpMapper">
<select id="queryIvtOutOne" resultType="org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp">
SELECT
ivt.*
FROM
ST_IVT_StructIvt_CP ivt
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
WHERE 1=1
<if test="stor_id != null and stor_id != ''">
and attr.stor_id = #{stor_id}
</if>
<if test="sect_id != null and sect_id != ''">
and attr.sect_id = #{sect_id}
</if>
<if test="material_id != null and material_id != ''">
and ivt.material_id = #{material_id}
</if>
<if test="sale_id != null and sale_id != ''">
and ivt.sale_id = #{sale_id}
</if>
order by ivt.canuse_qty ASC,ivt.struct_code ASC
LIMIT 1
</select>
</mapper>

View File

@@ -60,6 +60,10 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
// 减待入、加库存、加可用
subWrehousingAddQty(json);
break;
case ChangeIvtUtil.ADDFROZEN_SUBIVT_QTY:
// 加冻结、减可用
addFrozenSubQty(json);
break;
default:
throw new BadRequestException("变动类型异常!");
}
@@ -67,6 +71,11 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
}
@Override
public StIvtStructivtCp queryIvtOutOne(JSONObject json) {
return baseMapper.queryIvtOutOne(json);
}
/*
加待入
*/
@@ -177,6 +186,32 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
}
}
/*
加冻结、减可用
*/
private void addFrozenSubQty(JSONObject json) {
// 找到对应库存
StIvtStructivtCp ivtDao = this.getOne(
new QueryWrapper<StIvtStructivtCp>().lambda()
.eq(StIvtStructivtCp::getStruct_id, json.getString("struct_id"))
.eq(StIvtStructivtCp::getMaterial_id, json.getString("material_id"))
.eq(StIvtStructivtCp::getSale_id,json.getString("sale_id"))
);
if (ObjectUtil.isEmpty(ivtDao)) throw new BadRequestException("库存异常,请检查!");
// 冻结数
double frozen_qty = NumberUtil.add(ivtDao.getFrozen_qty().doubleValue(), json.getDoubleValue("change_qty"));
// 可用数
double canuse_qty = NumberUtil.sub(ivtDao.getCanuse_qty().doubleValue(), json.getDoubleValue("change_qty"));
if (canuse_qty < 0) throw new BadRequestException("库存异常,请检查!");
ivtDao.setCanuse_qty(BigDecimal.valueOf(canuse_qty));
ivtDao.setFrozen_qty(BigDecimal.valueOf(frozen_qty));
this.updateById(ivtDao);
}
/*
校验数据
*/

View File

@@ -17,5 +17,10 @@ public class ChangeIvtUtil {
*/
public static final String SUBWAREHOUSING_ADDIVT_QTY = "3";
/*
* 加冻结、减可用
*/
public static final String ADDFROZEN_SUBIVT_QTY = "4";
}

View File

@@ -2,6 +2,7 @@ package org.nl.wms.storage_manage.productmanage.util;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
/**
* <p>
@@ -17,11 +18,25 @@ public interface DivRuleCpService {
* 入库分配规则
* @param whereJson
* {
* "stor_id":仓库标识
* "sect_id":库区标识
* "rule_type":规则类型(后续优化)
* "stor_id":仓库标识 N
* "sect_id":库区标识 N
* "rule_type":规则类型(后续优化) N
* }
* @return StIvtStructattr /
*/
StIvtStructattr divRuleIn(JSONObject whereJson);
/**
* 出库分配规则
* @param whereJson
* {
* "stor_id":仓库标识 N
* "sect_id":库区标识 N
* "material_id":物料标识 Y
* "sale_id": 销售单标识 Y
* "rule_type":规则类型(后续优化) N
* }
* @return StIvtStructattr /
*/
StIvtStructivtCp divRuleOut(JSONObject whereJson);
}

View File

@@ -3,9 +3,16 @@ package org.nl.wms.storage_manage.productmanage.util;
public class RuleUtil {
/*
* 入库分配:
* 按照仓位顺序找一个仓位
*/
public static final String PRODUCTION_IN = "1";
public static final String PRODUCTION_IN_1 = "in_1";
/*
* 出库分配:
* 根据 仓库、库区、物料、销售单找库存
*/
public static final String PRODUCTION_OUT_1 = "out_1";
}

View File

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.storage_manage.productmanage.service.structIvt.IStIvtStructivtCpService;
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
import org.nl.wms.storage_manage.productmanage.util.DivRuleCpService;
import org.nl.wms.storage_manage.productmanage.util.RuleUtil;
import org.springframework.beans.factory.annotation.Autowired;
@@ -25,8 +27,13 @@ public class DivRuleCpServiceImpl implements DivRuleCpService {
@Autowired
protected IStIvtStructattrService iStIvtStructattrService; // 仓位属性服务
@Autowired
protected IStIvtStructivtCpService iStIvtStructivtCpService; // 仓位库存服务
private StIvtStructattr attrDao;
private StIvtStructivtCp ivtDao;
@Override
public StIvtStructattr divRuleIn(JSONObject whereJson) {
@@ -37,7 +44,7 @@ public class DivRuleCpServiceImpl implements DivRuleCpService {
if (ObjectUtil.isEmpty(sect_id)) throw new BadRequestException("库区不能为空!");
switch (whereJson.getString("rule_type")) {
case RuleUtil.PRODUCTION_IN :
case RuleUtil.PRODUCTION_IN_1 :
attrDao = iStIvtStructattrService.getOne(
new QueryWrapper<StIvtStructattr>().lambda()
.eq(StIvtStructattr::getStor_id, stor_id)
@@ -52,4 +59,27 @@ public class DivRuleCpServiceImpl implements DivRuleCpService {
return attrDao;
}
@Override
public StIvtStructivtCp divRuleOut(JSONObject whereJson) {
String stor_id = whereJson.getString("stor_id");
String sect_id = whereJson.getString("sect_id");
if (ObjectUtil.isEmpty(stor_id)) throw new BadRequestException("仓库不能为空!");
if (ObjectUtil.isEmpty(sect_id)) throw new BadRequestException("库区不能为空!");
switch (whereJson.getString("rule_type")) {
case RuleUtil.PRODUCTION_OUT_1 :
if (ObjectUtil.isEmpty(whereJson.getString("material_id")))
throw new BadRequestException("物料不能为空");
if (ObjectUtil.isEmpty(whereJson.getString("sale_id")))
throw new BadRequestException("销售单不能为空");
ivtDao = iStIvtStructivtCpService.queryIvtOutOne(whereJson);
break;
}
return ivtDao;
}
}

View File

@@ -325,27 +325,6 @@ export default {
}
}
},
tableChanged(rows) {
// 对新增的行进行校验不能存在相同物料批次
rows.forEach((item) => {
let same_mater = true
this.form.tableData.forEach((row) => {
if (row.material_code === item.material_code) {
same_mater = false
}
})
if (same_mater) {
item.quality_scode = '01'
item.ivt_level = '01'
item.is_active = '1'
item.plan_qty = '0'
item.edit = true
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
this.form.tableData.splice(-1, 0, item)
}
})
this.form.detail_count = this.form.tableData.length
},
tableChanged1(row) {
this.nowrow.material_id = row.material_id
this.nowrow.material_code = row.material_code
@@ -356,6 +335,28 @@ export default {
},
tableChanged2(row) {
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.source_bill_code === row.sale_code) {
same_mater = false
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.plan_qty = row.product_qty
data.qty_unit_name = row.qty_unit_name
data.qty_unit_id = row.qty_unit_id
data.source_billdtl_id = row.sale_id
data.source_bill_type = row.sale_type
data.source_bill_code = row.sale_code
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
this.form.detail_count = this.form.tableData.length
}
},
insertEvent(row) {

View File

@@ -20,7 +20,7 @@
>
<el-form-item label="销售单号">
<el-input
v-model="query.bill_code"
v-model="query.sale_code"
size="mini"
clearable
placeholder="销售单号"
@@ -30,14 +30,14 @@
<el-form-item label="客户编码">
<el-input
v-model="query.bill_code"
v-model="query.cust_code"
size="mini"
clearable
placeholder="客户编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<!--
<el-form-item label="创建日期">
<el-date-picker
v-model="query.createTime"
@@ -48,7 +48,7 @@
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
</el-form-item>-->
<rrOperation />
</el-form>
@@ -62,8 +62,13 @@
:data="crud.data"
style="width: 100%;"
@selection-change="crud.selectionChangeHandler"
@current-change="clickChange"
>
<el-table-column type="selection" width="55" />
<el-table-column label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip width="150" prop="sale_code" label="销售单号" />
<el-table-column show-overflow-tooltip width="150" prop="sale_type" label="销售单类型" />
<el-table-column show-overflow-tooltip width="150" prop="status" label="状态" />
@@ -72,6 +77,7 @@
<el-table-column show-overflow-tooltip width="150" prop="sale_qty" label="销售数量" />
<el-table-column show-overflow-tooltip width="150" prop="cust_code" label="客户编码" />
<el-table-column show-overflow-tooltip width="150" prop="cust_name" label="客户名称" />
<el-table-column show-overflow-tooltip width="150" prop="product_qty" label="生产数量" />
<el-table-column show-overflow-tooltip width="150" prop="qty_unit_name" label="单位" />
<el-table-column show-overflow-tooltip width="150" prop="plandeliver_date" label="计划交期" />
<el-table-column show-overflow-tooltip width="150" prop="create_name" label="创建人" />
@@ -104,7 +110,7 @@ export default {
cruds() {
return CRUD({
title: '用户',
url: '/api/mdPbBucketrecord',
url: '/api/mpsSaleOrder',
crudMethod: {},
optShow: {
reset: true
@@ -125,6 +131,7 @@ export default {
return {
dialogVisible: false,
rows: [],
tableRadio: null,
tableData: []
}
},
@@ -146,13 +153,13 @@ export default {
close() {
this.$emit('update:dialogShow', false)
},
clickChange(item) {
this.tableRadio = item
},
submit() {
this.$emit('update:dialogShow', false)
this.rows = this.$refs.multipleTable.selection
crudProductIn.queryBoxMater(this.rows).then(res => {
this.rows = res
this.$emit('tableChanged', this.rows)
})
this.$emit('tableChanged', this.tableRadio)
}
}
}

View File

@@ -325,27 +325,6 @@ export default {
}
}
},
tableChanged(rows) {
// 对新增的行进行校验不能存在相同物料批次
rows.forEach((item) => {
let same_mater = true
this.form.tableData.forEach((row) => {
if (row.material_code === item.material_code) {
same_mater = false
}
})
if (same_mater) {
item.quality_scode = '01'
item.ivt_level = '01'
item.is_active = '1'
item.plan_qty = '0'
item.edit = true
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
this.form.tableData.splice(-1, 0, item)
}
})
this.form.detail_count = this.form.tableData.length
},
tableChanged1(row) {
this.nowrow.material_id = row.material_id
this.nowrow.material_code = row.material_code
@@ -356,7 +335,28 @@ export default {
},
tableChanged2(row) {
let same_mater = true
this.form.tableData.forEach((item) => {
if (item.source_bill_code === row.sale_code) {
same_mater = false
}
})
if (same_mater) {
const data = {}
data.material_id = row.material_id
data.material_code = row.material_code
data.material_name = row.material_name
data.plan_qty = row.delivery_qty
data.qty_unit_name = row.qty_unit_name
data.qty_unit_id = row.qty_unit_id
data.source_billdtl_id = row.sale_id
data.source_bill_type = row.sale_type
data.source_bill_code = row.sale_code
data.edit = true
this.form.tableData.splice(-1, 0, data)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(data.plan_qty)
this.form.detail_count = this.form.tableData.length
}
},
insertEvent(row) {
this.dtlShow = true

View File

@@ -1,7 +1,6 @@
<!--suppress ALL -->
<template>
<el-dialog
title="物料选择"
title="单据选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
@@ -11,38 +10,58 @@
@open="open"
>
<div class="head-container">
<div>
<!-- 搜索 -->
<el-input
v-model="query.material_code"
clearable
size="mini"
placeholder="物料编码、名称"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input
v-model="query.material_spec"
clearable
size="mini"
placeholder="物料规格"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input
v-model="query.pcsn"
clearable
size="mini"
placeholder="单号"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<rrOperation />
</div>
</div>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="发货单号">
<el-input
v-model="query.deliver_code"
size="mini"
clearable
placeholder="销售单号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="销售单号">
<el-input
v-model="query.sale_code"
size="mini"
clearable
placeholder="销售单号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="客户编码">
<el-input
v-model="query.cust_code"
size="mini"
clearable
placeholder="客户编码"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<!--
<el-form-item label="创建日期">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>-->
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="multipleTable"
@@ -51,19 +70,25 @@
style="width: 100%;"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="clickChange"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="instorage_time" label="入库日期" :min-width="flexWidth('instorage_time',crud.data,'入库日期')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="material_spec" label="物料规格" :min-width="flexWidth('material_name',crud.data,'物料规格')" />
<el-table-column prop="struct_code" label="点位" :min-width="flexWidth('struct_name',crud.data,'点位')" />
<el-table-column prop="pcsn" label="订单号" :min-width="flexWidth('pcsn',crud.data,'订单号')" />
<el-table-column show-overflow-tooltip prop="plan_qty" :formatter="crud.formatNum3" label="可用数" />
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="重量单位" />
<el-table-column label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip width="150" prop="deliver_code" label="单据号" />
<el-table-column show-overflow-tooltip width="150" prop="status" label="状态" />
<el-table-column show-overflow-tooltip width="150" prop="material_code" label="物料编码" />
<el-table-column show-overflow-tooltip width="150" prop="material_name" label="物料名称" />
<el-table-column show-overflow-tooltip width="150" prop="cust_code" label="客户编码" />
<el-table-column show-overflow-tooltip width="150" prop="cust_name" label="客户名称" />
<el-table-column show-overflow-tooltip width="150" prop="delivery_qty" label="数量" />
<el-table-column show-overflow-tooltip width="150" prop="qty_unit_name" label="单位" />
</el-table>
<!--分页组件-->
<pagination />
</div>
<span slot="footer" class="dialog-footer">
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
@@ -73,16 +98,17 @@
<script>
import CRUD, { header, presenter } from '@crud/crud'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
export default {
name: 'AddDtl',
components: { rrOperation, pagination },
components: { rrOperation, pagination, crudOperation },
cruds() {
return CRUD({
title: '用户', url: 'api/productOut/addDtl',
title: '用户', url: 'api/stIfDeliveryorderCp',
optShow: {
add: false,
edit: false,
@@ -113,6 +139,7 @@ export default {
dialogVisible: false,
opendtlParam: '',
rows: [],
tableRadio:null,
openShow: true
}
},
@@ -130,14 +157,7 @@ export default {
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
this.crud.query.mater_type = this.opendtlParam
this.crud.query.stor_id = this.storId
if (this.openShow) {
this.openShow = false
return false
} else {
return true
}
return true
},
close() {
this.crud.resetQuery(false)
@@ -148,15 +168,13 @@ export default {
open() {
this.crud.query.mater_type = this.opendtlParam
},
clickChange(item) {
this.tableRadio = item
},
submit() {
this.rows = this.$refs.multipleTable.selection
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
this.rows = this.$refs.multipleTable.selection
this.$emit('tableChanged', this.tableRadio)
}
}
}

View File

@@ -44,7 +44,7 @@
type="primary"
icon="el-icon-plus"
size="mini"
@click="allDiv()"
@click="allDivIvt()"
>
全部分配
</el-button>
@@ -65,7 +65,6 @@
type="primary"
icon="el-icon-check"
size="mini"
:disabled="button1"
@click="oneDiv()"
>
自动分配
@@ -76,7 +75,6 @@
type="primary"
icon="el-icon-check"
size="mini"
:disabled="button2"
@click="oneCancel()"
>
自动取消
@@ -111,7 +109,6 @@
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip prop="material_spec" label="物料规格" align="center" />
<el-table-column show-overflow-tooltip prop="pcsn" label="订单号" align="center" width="140px" />
<el-table-column show-overflow-tooltip prop="plan_qty" label="重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="assign_qty" label="已分配重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="unassign_qty" label="未分配重量" :formatter="crud.formatNum3" align="center" />
@@ -169,7 +166,6 @@
:loading="loadingSetAllPoint"
type="warning"
icon="el-icon-check"
:disabled="button5"
size="mini"
@click="allSetPoint"
>
@@ -238,7 +234,7 @@ export default {
type: Boolean,
default: false
},
rowmst: {
rowMst: {
type: Object
},
openArray: {
@@ -262,10 +258,6 @@ export default {
pointshow: false,
structshow: false,
button1: true,
button2: true,
button3: true,
button4: true,
button5: true,
tableDtl: [],
openParam: [],
mstrow: {},
@@ -299,7 +291,7 @@ export default {
this.tableDtl = newValue
}
},
rowmst: {
rowMst: {
handler(newValue, oldValue) {
this.mstrow = newValue
}
@@ -357,62 +349,32 @@ export default {
this.mstrow.sect_id = val[1]
}
},
deleteRow(row) {
productOut.oneCancel(row).then(res => {
this.queryTableDtl()
})
},
handleDtlCurrentChange(current) {
if (current !== null) {
this.currentRow = current
this.form2.unassign_qty = current.unassign_qty
this.form2.assign_qty = current.assign_qty
this.tabledis = []
if (current.bill_status === '10') {
this.button1 = false
this.button2 = true
this.button5 = false
this.button3 = false
} else if (current.bill_status === '20') {
this.button1 = false
this.button2 = false
this.button3 = false
this.button5 = false
} else if (current.bill_status === '30') {
this.button1 = true
this.button2 = false
this.button3 = true
this.button5 = false
}
this.queryTableDdis(current.iostorinvdtl_id)
} else {
this.button1 = true
this.button2 = true
this.button3 = true
this.button5 = true
this.mstrow.iostorinvdtl_id = ''
this.currentRow = {}
this.tabledis = []
}
this.queryTableDdis(current)
},
handleDisCurrentChange(current) {
if (current !== null) {
this.currentDis = current
if (current.work_status === '01' || current.work_status === '00') {
this.button4 = false
} else {
this.button4 = true
}
} else {
this.button4 = true
this.mstrow.iostorinvdis_id = ''
this.currentDis = {}
}
},
allDiv() {
queryTableDtl() {
productOut.getIosInvDtl({ 'iostorinv_id': this.mstrow.iostorinv_id }).then(res => {
this.tableDtl = res
})
},
queryTableDdis(row) {
productOut.getIosInvDis({ 'iostorinvdtl_id': row.iostorinvdtl_id, 'iostorinv_id': row.iostorinv_id }).then(res => {
this.tabledis = res
}).catch(() => {
this.tabledis = []
})
},
allDivIvt() {
if (this.mstrow.sect_id === '') {
this.crud.notify('请选择库区!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
this.loadingAlldiv = true
productOut.allDiv(this.mstrow).then(res => {
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
productOut.allDivIvt({ 'iostorinv_id': this.mstrow.iostorinv_id, 'sect_id': this.mstrow.sect_id, 'stor_id': this.mstrow.stor_id }).then(res => {
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.queryTableDtl()
this.loadingAlldiv = false
}).catch(() => {
@@ -443,18 +405,7 @@ export default {
})
}
},
queryTableDtl() {
productOut.getOutBillDtl({ 'iostorinv_id': this.mstrow.iostorinv_id }).then(res => {
this.tableDtl = res
})
},
queryTableDdis(iostorinvdtl_id) {
productOut.getOutBillDis({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => {
this.tabledis = res
}).catch(() => {
this.tabledis = []
})
},
cellStyle({ row, column, rowIndex, columnIndex }) {
const assign_qty = parseFloat(row.assign_qty)
const plan_qty = parseFloat(row.plan_qty)

View File

@@ -169,7 +169,7 @@
</div>
<AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
<DivDialog :dialog-show.sync="divShow" :open-array="openParam" :stor-id="storId" :rowmst="mstrow" @DivChanged="querytable" />
<DivDialog :dialog-show.sync="divShow" :open-array="openParam" :stor-id="storId" :row-mst="mstrow" @DivChanged="querytable" />
</div>
</template>

View File

@@ -32,4 +32,27 @@ export function getIosInvDtl(data) {
})
}
export default { add, edit, del, getIosInvDtl }
export function getIosInvDis(data) {
return request({
url: 'api/productOut/getIosInvDis',
method: 'post',
data
})
}
export function allDivIvt(data) {
return request({
url: 'api/productOut/allDivIvt',
method: 'post',
data
})
}
export default {
add,
edit,
del,
getIosInvDtl,
getIosInvDis,
allDivIvt
}