add: 成品损益

This commit is contained in:
2023-05-29 17:05:45 +08:00
parent 3144e5f746
commit 3e0277b43e
16 changed files with 618 additions and 723 deletions

View File

@@ -1,8 +1,16 @@
package org.nl.wms.storage_manage.productmanage.controller.moreOrLess;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiOperation;
import org.nl.common.anno.Log;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessmstCpService;
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
/**
* <p>
@@ -13,8 +21,57 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2023-05-04
*/
@RestController
@RequestMapping("/stIvtMoreorlessmstCp")
@RequestMapping("/api/stIvtMoreorlessmstCp")
public class StIvtMoreorlessmstCpController {
@Autowired
private IStIvtMoreorlessmstCpService iStIvtMoreorlessmstCpService;
@GetMapping
@Log("查询损溢单")
@ApiOperation("查询损溢单")
public ResponseEntity<Object> query(MoreOrlessQuery query, PageQuery page) {
return new ResponseEntity<>(iStIvtMoreorlessmstCpService.pageQuery(query, page), HttpStatus.OK);
}
@PostMapping
@Log("创建损溢单")
@ApiOperation("创建损溢单")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
iStIvtMoreorlessmstCpService.create(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/getMlDtl")
@Log("查询损溢明细")
@ApiOperation("查询损溢明细")
public ResponseEntity<Object> getMlDtl(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(iStIvtMoreorlessmstCpService.getMlDtl(whereJson), HttpStatus.OK);
}
@PostMapping("/update")
@Log("修改损溢单")
@ApiOperation("修改损溢单")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
iStIvtMoreorlessmstCpService.update(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/delete")
@Log("删除入库单")
@ApiOperation("删除入库单")
public ResponseEntity<Object> delete(@RequestBody Long[] ids){
iStIvtMoreorlessmstCpService.delete(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/confirm")
@Log("完成单据")
@ApiOperation("完成单据")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
iStIvtMoreorlessmstCpService.confirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

View File

@@ -1,7 +1,13 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +19,13 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
*/
public interface IStIvtMoreorlessdtlCpService extends IService<StIvtMoreorlessdtlCp> {
/**
* 主单据使用
* @param row
* @param mst
* @return
*/
double create(JSONArray row, StIvtMoreorlessmstCp mst);
List<Map> getMlDtl(JSONObject form);
}

View File

@@ -1,7 +1,13 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +19,22 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
*/
public interface IStIvtMoreorlessmstCpService extends IService<StIvtMoreorlessmstCp> {
Object pageQuery(MoreOrlessQuery query, PageQuery page);
void create(JSONObject jo);
List<Map> getMlDtl(JSONObject map);
void update(JSONObject map);
/**
* 删除
* @param ids
* {
* 主表id..
* }
*/
void delete(Long[] ids);
void confirm(JSONObject form);
}

View File

@@ -81,7 +81,7 @@ public class StIvtMoreorlessmstCp implements Serializable {
/**
* 创建时间
*/
private LocalDateTime create_time;
private String create_time;
/**
* 审核人

View File

@@ -1,8 +1,13 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
import java.util.List;
import java.util.Map;
/**
* <p>
* 损溢单明细表 Mapper 接口
@@ -13,4 +18,6 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
*/
public interface StIvtMoreorlessdtlCpMapper extends BaseMapper<StIvtMoreorlessdtlCp> {
List<Map> getMlDtl(@Param("map") JSONObject map);
}

View File

@@ -2,4 +2,19 @@
<!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.StIvtMoreorlessdtlCpMapper">
<select id="getMlDtl" resultType="java.util.Map">
SELECT
dtl.*,
mb.material_code,
mb.material_name
FROM
st_ivt_moreorlessdtl_cp dtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = dtl.material_id
<where>
<if test="map.mol_id != null and map.mol_id != ''">
dtl.mol_id = #{map.mol_id}
</if>
</where>
</select>
</mapper>

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.StIvtMoreorlessmstCp;
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
import java.util.List;
import java.util.Map;
/**
* <p>
@@ -13,4 +19,6 @@ import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreo
*/
public interface StIvtMoreorlessmstCpMapper extends BaseMapper<StIvtMoreorlessmstCp> {
List<Map> getMstDetail(@Param("query") MoreOrlessQuery query, @Param("pageQuery") PageQuery pageQuery);
}

View File

@@ -1,5 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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.StIvtMoreorlessmstCpMapper">
<select id="getMstDetail" resultType="java.util.Map">
SELECT
mst.*,
a.total_qty,
a.struct_name,
sa.struct_code,
sa.struct_id,
sa.sect_id,
sa.sect_name
FROM
st_ivt_moreorlessmst_cp mst
LEFT JOIN (
SELECT
dtl.struct_name,
dtl.struct_id,
SUM( dtl.mol_qty ) AS total_qty,
dtl.mol_id
FROM
st_ivt_moreorlessdtl_yl dtl
GROUP BY
dtl.struct_name,
dtl.mol_id,
dtl.struct_id
) a ON a.mol_id = mst.mol_id
LEFT JOIN st_ivt_structattr sa ON sa.struct_id = a.struct_id
<where>
mst.is_delete = '0'
<if test="query.start_time != null">
and mst.create_time >= #{query.start_time}
</if>
<if test="query.end_time != null">
and #{query.end_time} >= mst.create_time
</if>
<if test="query.stor_id != null and query.stor_id != ''">
and mst.stor_id = #{query.stor_id}
</if>
<if test="query.status != null and query.status != ''">
and mst.status = #{query.status}
</if>
<if test="query.mol_inv_type != null and query.mol_inv_type != ''">
and mst.mol_inv_type = #{query.mol_inv_type}
</if>
<if test="query.mol_code != null and query.mol_code != ''">
and mst.mol_code = #{query.mol_code}
</if>
<if test="query.mol_type != null and query.mol_type != ''">
and mst.mol_type = #{query.mol_type}
</if>
</where>
</select>
</mapper>

View File

@@ -1,11 +1,31 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.nl.common.utils.IdUtil;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtSectattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtStructattrService;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtSectattr;
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessdtlCpService;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIvtMoreorlessdtlCpMapper;
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dao.StIvtMoreorlessdtlYl;
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dao.StIvtMoreorlessmstYl;
import org.nl.wms.storage_manage.semimanage.MLEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* <p>
* 损溢单明细表 服务实现类
@@ -17,4 +37,57 @@ import org.springframework.stereotype.Service;
@Service
public class StIvtMoreorlessdtlCpServiceImpl extends ServiceImpl<StIvtMoreorlessdtlCpMapper, StIvtMoreorlessdtlCp> implements IStIvtMoreorlessdtlCpService {
@Autowired
private IStIvtSectattrService sectattrService; // 库区属性服务
@Autowired
private IStIvtStructattrService structattrService; // 仓位属性服务
@Override
public List<Map> getMlDtl(JSONObject form) {
return this.baseMapper.getMlDtl(form);
}
@Override
public double create(JSONArray rows, StIvtMoreorlessmstCp mst) {
double total_qty = 0;
if (rows.size() > 0 && ObjectUtil.isNotEmpty(mst)) {
// 先删除在插入
this.remove(new QueryWrapper<StIvtMoreorlessdtlCp>().eq("mol_id", mst.getMol_id()));
for (int i = 0; i < rows.size(); i++) {
String mol_dtl_id = IdUtil.getStringId();
StIvtMoreorlessdtlCp row = rows.getJSONObject(i).toJavaObject(StIvtMoreorlessdtlCp.class);
row.setMol_dtl_id(mol_dtl_id);
row.setMol_id(mst.getMol_id());
row.setMol_code(mst.getMol_code());
row.setSeq_no(BigDecimal.valueOf(i + 1));
// 获取库区信息
QueryWrapper<StIvtSectattr> sect_wrapper = new QueryWrapper<>();
sect_wrapper.eq("sect_id", row.getSect_id());
sect_wrapper.eq("is_used", true);
StIvtSectattr sectDao = sectattrService.getOne(sect_wrapper);
if (ObjectUtil.isEmpty(sectDao)) throw new BadRequestException("库区不存在或未启用!");
row.setSect_name(sectDao.getSect_name());
// 获取仓位信息
QueryWrapper<StIvtStructattr> struct_wrapper = new QueryWrapper<>();
struct_wrapper.eq("struct_id", row.getStruct_id());
struct_wrapper.eq("is_used", true);
StIvtStructattr structDao = structattrService.getOne(struct_wrapper);
if (ObjectUtil.isEmpty(structDao)) throw new BadRequestException("仓位不存在或未启用!");
row.setStruct_name(structDao.getStruct_name());
row.setStoragevehicle_id("999999");
row.setStoragevehicle_code("999999");
row.setStatus(MLEnum.DTL_STATUS.code("生成"));
this.save(row);
//锁定货位
structattrService.update(new UpdateWrapper<StIvtStructattr>().set("lock_type", "1").set("inv_code",mst.getMol_code()).eq("struct_id", row.getStruct_id()));
}
}
return total_qty;
}
}

View File

@@ -1,11 +1,48 @@
package org.nl.wms.storage_manage.productmanage.service.moreOrLess.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.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
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.utils.IdUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
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.storage_manage.CHECKEnum;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessdtlCpService;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.IStIvtMoreorlessmstCpService;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessdtlCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.StIvtMoreorlessmstCp;
import org.nl.wms.storage_manage.productmanage.service.moreOrLess.dao.mapper.StIvtMoreorlessmstCpMapper;
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.rawmanage.service.moveOrLess.dao.StIvtMoreorlessdtlYl;
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dao.StIvtMoreorlessmstYl;
import org.nl.wms.storage_manage.rawmanage.service.moveOrLess.dto.MoreOrlessQuery;
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
import org.nl.wms.storage_manage.semimanage.MLEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* <p>
* 损溢单主表 服务实现类
@@ -17,4 +54,193 @@ import org.springframework.stereotype.Service;
@Service
public class StIvtMoreorlessmstCpServiceImpl extends ServiceImpl<StIvtMoreorlessmstCpMapper, StIvtMoreorlessmstCp> implements IStIvtMoreorlessmstCpService {
@Autowired
private IStIvtMoreorlessdtlCpService iStIvtMoreorlessdtlCpService; // 损益明细服务
@Autowired
private IStIvtBsrealstorattrService stIvtBsrealstorattrService; // 实物属性服务
@Autowired
private IStIvtStructivtCpService iStIvtStructivtCpService; // 库存服务
@Autowired
private IStIvtStructattrService structattrService; // 仓位属性服务
@Override
public Object pageQuery(MoreOrlessQuery query, PageQuery pageQuery) {
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
List<Map> mst_detail = this.baseMapper.getMstDetail(query, pageQuery);
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
build.setTotalElements(page.getTotal());
return build;
}
@Override
public void create(JSONObject form) {
JSONArray rows = form.getJSONArray("tableData");
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
// 调用主表 插入/更新方法
StIvtMoreorlessmstCp mlmstCP = packageMstForm(new StIvtMoreorlessmstCp(), form);
this.save(mlmstCP);
//调用明细表 插入方法
iStIvtMoreorlessdtlCpService.create(rows, mlmstCP);
if (form.containsKey("auto_confirm") && form.getString("auto_confirm").equals("1")) {
JSONObject mst = new JSONObject();
mst.put("mol_id", mlmstCP.getMol_id());
this.confirm(mst);
}
}
@Override
public List<Map> getMlDtl(JSONObject map) {
return iStIvtMoreorlessdtlCpService.getMlDtl(map);
}
@Override
public void update(JSONObject form) {
Assert.notNull(new Object[]{form, form.get("mol_id")}, "请求参数不能为空");
StIvtMoreorlessmstCp mst = form.toJavaObject(StIvtMoreorlessmstCp.class);
this.updateById(mst);
JSONArray rows = form.getJSONArray("tableData");
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
// 调用明细表 插入/更新方法
iStIvtMoreorlessdtlCpService.create(rows, mst);
}
@Override
public void delete(Long[] ids) {
for (Long id : ids) {
StIvtMoreorlessmstCp dao = this.getOne(new QueryWrapper<StIvtMoreorlessmstCp>().eq("mol_id", id));
dao.setIs_delete(true);
this.updateById(dao);
}
}
@Override
public void confirm(JSONObject whereJson) {
String mol_id = (String) whereJson.get("mol_id");
StIvtMoreorlessmstCp mst = this.getOne(new QueryWrapper<StIvtMoreorlessmstCp>().eq("mol_id", mol_id));
if (!mst.getStatus().equals(MLEnum.BILL_STATUS.code("生成"))) {
throw new BadRequestException("请选择单据状态为生成的损溢单!");
}
String mol_type = mst.getMol_type();
List<StIvtMoreorlessdtlCp> dtl_list = iStIvtMoreorlessdtlCpService.list(new QueryWrapper<StIvtMoreorlessdtlCp>().eq("mol_id", mol_id));
//更新库存
if (mol_type.equals(MLEnum.MOL_TYPE.code(""))) {
dtl_list.forEach(dtl -> {
StIvtStructivtCp ivt = iStIvtStructivtCpService.getOne(new QueryWrapper<StIvtStructivtCp>().eq("struct_id", dtl.getStruct_id()).eq("material_id", dtl.getMaterial_id()));
if (ObjectUtil.isEmpty(ivt)) {
throw new BadRequestException("未查询到相关库存!");
}
BigDecimal canuse_qty = ivt.getCanuse_qty();
BigDecimal ivt_qty = ivt.getIvt_qty();
BigDecimal mol_qty = dtl.getMol_qty();
ivt.setCanuse_qty(NumberUtil.sub(canuse_qty, mol_qty));
ivt.setIvt_qty(NumberUtil.sub(ivt_qty, mol_qty));
//如果库存变为0则删除记录
if (canuse_qty.compareTo(mol_qty) == 0 && canuse_qty.compareTo(ivt_qty) == 0) {
iStIvtStructivtCpService.removeById(ivt.getStockrecord_id());
} else {
iStIvtStructivtCpService.updateById(ivt);
}
});
} else {
dtl_list.forEach(dtl -> {
StIvtStructivtCp ivt = iStIvtStructivtCpService.getOne(new QueryWrapper<StIvtStructivtCp>().eq("struct_id", dtl.getStruct_id()).eq("material_id", dtl.getMaterial_id()));
BigDecimal mol_qty = dtl.getMol_qty();
if (ObjectUtil.isEmpty(ivt)) {
StIvtStructattr struct_jo = structattrService.getOne(new QueryWrapper<StIvtStructattr>().eq("struct_id", dtl.getStruct_id()));
//新增一条库存记录
iStIvtStructivtCpService.save(new StIvtStructivtCp()
.setStockrecord_id(IdUtil.getStringId())
.setStruct_id(dtl.getStruct_id())
.setStruct_code(struct_jo.getStruct_code())
.setStruct_name(struct_jo.getStruct_name())
.setMaterial_id(dtl.getMaterial_id())
.setQuality_scode(dtl.getQuality_scode())
.setPcsn(dtl.getPcsn())
.setIvt_level(dtl.getIvt_level())
.setIs_active(dtl.getIs_active())
.setCanuse_qty(mol_qty)
.setIvt_qty(mol_qty)
.setQty_unit_id(dtl.getQty_unit_id())
.setInstorage_time(DateUtil.now())
.setStor_id(mst.getStor_id())
);
} else {
BigDecimal canuse_qty = ivt.getCanuse_qty();
BigDecimal ivt_qty = ivt.getIvt_qty();
ivt.setCanuse_qty(NumberUtil.add(canuse_qty, mol_qty));
ivt.setIvt_qty(NumberUtil.add(ivt_qty, mol_qty));
iStIvtStructivtCpService.updateById(ivt);
}
//更新明细状态
dtl.setStatus(MLEnum.DTL_STATUS.code("确认完成"));
iStIvtMoreorlessdtlCpService.updateById(dtl);
});
}
dtl_list.stream().map(dtl -> dtl.getStruct_id())
.distinct()
.forEach(struct_id -> structattrService.update(new UpdateWrapper<StIvtStructattr>().set("lock_type", "0").set("inv_code", "").eq("struct_id", struct_id)));
//更新损溢单主表
mst.setStatus(MLEnum.BILL_STATUS.code("完成"));
mst.setConfirm_optid(SecurityUtils.getCurrentUserId());
mst.setConfirm_optname(SecurityUtils.getCurrentNickName());
mst.setConfirm_time(DateUtil.now());
this.updateById(mst);
}
@NotNull
private StIvtMoreorlessmstCp packageMstForm(StIvtMoreorlessmstCp mlmstCP, JSONObject whereJson) {
JSONArray rows = whereJson.getJSONArray("tableData");
// 新增
mlmstCP.setMol_id(IdUtil.getStringId());
mlmstCP.setMol_code(CodeUtil.getNewCode("MOL_CODE"));
if (StrUtil.isEmpty(whereJson.getString("buss_type"))) {
mlmstCP.setBuss_type(MLEnum.BILL_TYPE.code("普通损溢"));
mlmstCP.setMol_inv_type(MLEnum.BILL_TYPE.code("普通损溢"));
} else {
mlmstCP.setBuss_type(whereJson.getString("buss_type"));
mlmstCP.setMol_inv_type(whereJson.getString("buss_type"));
}
mlmstCP.setMol_type(whereJson.getString("mol_type"));
// 获取仓库信息
QueryWrapper<StIvtBsrealstorattr> wrapper = new QueryWrapper<>();
wrapper.eq("stor_id", whereJson.getString("stor_id"));
wrapper.eq("is_used", true);
StIvtBsrealstorattr bsrealDao = stIvtBsrealstorattrService.getOne(wrapper);
if (ObjectUtil.isEmpty(bsrealDao)) throw new BadRequestException("仓库不存在或未启用!");
mlmstCP.setStor_id(bsrealDao.getStor_id());
mlmstCP.setStor_name(bsrealDao.getStor_name());
mlmstCP.setDtl_num(BigDecimal.valueOf(rows.size()));
mlmstCP.setCreate_mode(CHECKEnum.CREATE_MODE.code("PC产生"));
mlmstCP.setStatus(CHECKEnum.BILL_STATUS.code("生成"));
mlmstCP.setCreate_id(SecurityUtils.getCurrentUserId());
mlmstCP.setCreate_name(SecurityUtils.getCurrentNickName());
mlmstCP.setCreate_time(DateUtil.now());
mlmstCP.setIs_delete(false);
// TODO 暂时写死
mlmstCP.setSysdeptid("111");
mlmstCP.setSyscompanyid("111");
mlmstCP.setRemark(whereJson.getString("remark"));
return mlmstCP;
}
}

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.math.BigDecimal;
@@ -17,6 +18,7 @@ import java.math.BigDecimal;
* @since 2023-05-04
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@TableName("st_ivt_structivt_cp")
public class StIvtStructivtCp implements Serializable {

View File

@@ -11,20 +11,35 @@
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
<span/>
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
<el-button
icon="el-icon-check"
size="mini"
:loading="crud.cu === 2"
type="primary"
@click="crud.submitCU"
>保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
<el-form
ref="form"
style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;"
:inline="true"
:model="form"
:rules="rules"
size="mini"
label-width="85px"
label-suffix=":"
>
<el-form-item label="单据号" prop="bill_code">
<label slot="label">单&nbsp;&nbsp;据&nbsp;号:</label>
<el-input v-model.trim="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
<el-input v-model.trim="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px"/>
</el-form-item>
<el-form-item label="仓库" prop="stor_id">
<label slot="label">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库:</label>
@@ -64,12 +79,12 @@
<el-form-item label="货位" prop="struct_code">
<label slot="label">货&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位:</label>
<el-input v-model.trim="form.struct_code" style="width: 210px" disabled placeholder="选择货位">
<el-button v-show="crud.status.view <= 0" slot="append" icon="el-icon-plus" @click="queryStruct()" />
<el-button v-show="crud.status.view <= 0" slot="append" icon="el-icon-plus" @click="queryStruct()"/>
</el-input>
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
<el-input v-model.trim="form.dtl_num" size="mini" disabled style="width: 210px" />
<el-input v-model.trim="form.dtl_num" size="mini" disabled style="width: 210px"/>
</el-form-item>
<el-form-item label="总重量" prop="total_qty">
<label slot="label">总&nbsp;&nbsp;重&nbsp;量:</label>
@@ -84,7 +99,13 @@
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model.trim="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
<el-input
v-model.trim="form.remark"
style="width: 380px;"
rows="2"
type="textarea"
:disabled="crud.status.view > 0"
/>
</el-form-item>
</el-form>
@@ -92,7 +113,7 @@
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<slot name="left"/>
<!--<el-button
slot="left"
class="filter-item"
@@ -127,89 +148,31 @@
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具号" align="center" width="150px">
<el-table-column type="index" label="序号" width="55" align="center"/>
<el-table-column prop="material_code" label="物料编码" align="center" min-width="200" show-overflow-tooltip>
<template scope="scope">
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.storagevehicle_code" size="mini" />
<span v-show="scope.row.edit">{{ scope.row.storagevehicle_code }}</span>
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.storagevehicle_code }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="bucketunique" label="桶号" width="190" align="center">
<template scope="scope">
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.bucketunique" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-plus" @click="queryBucket(scope.$index, scope.row)" />
<el-input v-show="!scope.row.edit" v-model="scope.row.material_code" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="queryMater(scope.$index, scope.row)"/>
</el-input>
<span v-show="scope.row.edit">{{ scope.row.bucketunique }}</span>
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.bucketunique }}</span>
<span v-show="scope.row.edit">{{ scope.row.material_code }}</span>
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码" align="center" min-width="200" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" align="center" min-width="200" show-overflow-tooltip />
<el-table-column prop="pcsn" label="批次号" align="center" min-width="200" show-overflow-tooltip />
<el-table-column prop="quality_scode" label="品质类型" align="center" width="150px">
<template slot-scope="scope">
<el-select
v-model="scope.row.quality_scode"
size="mini"
clearable
class="filter-item"
disabled
>
<el-option
v-for="item in dict.ST_QUALITY_SCODE"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="ivt_level" label="库存等级" align="center" width="150px">
<template slot-scope="scope">
<el-select
v-model="scope.row.ivt_level"
size="mini"
clearable
class="filter-item"
placeholder=""
disabled
>
<el-option
v-for="item in dict.ST_IVT_LEVEL"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="is_active" label="是否可用" align="center" width="150px">
<template slot-scope="scope">
<el-select
v-model="scope.row.is_active"
size="mini"
clearable
class="filter-item"
placeholder=""
disabled
>
<el-option
v-for="item in dict.is_used"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="ivt_qty" label="库存重量" align="center" :formatter="crud.formatNum3" />
<el-table-column prop="material_name" label="物料名称" align="center" min-width="200" show-overflow-tooltip/>
<el-table-column v-if="!crud.status.view > 0" prop="ivt_qty" label="库存重量" align="center"
:formatter="crud.formatNum3"/>
<el-table-column prop="mol_qty" width="220" label="损溢重量" align="center">
<template scope="scope">
<el-input-number v-model="scope.row.mol_qty" :disabled="scope.row.edit" :precision="3" :controls="false" :min="0" style="width: 120px" />
<el-input-number
v-model="scope.row.mol_qty"
:disabled="scope.row.edit"
:precision="3"
:controls="false"
:min="0"
style="width: 120px"
/>
</template>
</el-table-column>
<el-table-column prop="qty_unit_name" label="单位" align="center" />
<el-table-column prop="qty_unit_name" label="单位" align="center"/>
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="190" fixed="right">
<template scope="scope">
<el-button
@@ -241,17 +204,16 @@
</el-table-column>
</el-table>
<MaterDtl :dialog-show.sync="materShow" :dialog-matertype="materType" @tableChanged2="tableChanged2" />
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="tableChanged" />
<BucketDialog :dialog-show.sync="bucketShow" @bucketChange="tableChanged2" />
<MaterDtl :dialog-show.sync="materShow" @setMaterValue="tableChanged2"/>
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="tableChanged"/>
</el-dialog>
</template>
<script>
import crudOperation from '@crud/CRUD.operation'
import BucketDialog from '@/views/wms/storage_manage/product/productMoreOrless/NewBucketDialog'
import CRUD, { crud, form } from '@crud/crud'
import crudStorattr from '@/api/wms/basedata/st/storattr'
import CRUD, {crud, form} from '@crud/crud'
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
import crudMoreOrless from '@/views/wms/storage_manage/product/productMoreOrless/moreorless'
import MaterDtl from '@/views/wms/pub/MaterDialog'
import StructDiv from '@/views/wms/storage_manage/product/productMoreOrless/StructDiv'
@@ -275,7 +237,7 @@ const defaultForm = {
export default {
name: 'AddDialog',
components: { crudOperation, MaterDtl, StructDiv, BucketDialog },
components: {crudOperation, MaterDtl, StructDiv, BucketDialog},
mixins: [crud(), form(defaultForm)],
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'ST_MOL_TYPE'],
props: {
@@ -301,13 +263,13 @@ export default {
storlist: [],
rules: {
stor_id: [
{ required: true, message: '仓库不能为空', trigger: 'blur' }
{required: true, message: '仓库不能为空', trigger: 'blur'}
],
bill_type: [
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
{required: true, message: '业务类型不能为空', trigger: 'blur'}
],
biz_date: [
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
{required: true, message: '业务日期不能为空', trigger: 'blur'}
]
}
}
@@ -322,31 +284,30 @@ export default {
methods: {
open() {
// 查询原材料库的仓库
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
crudStorattr.getStor({'stor_type': '3'}).then(res => {
this.storlist = res.content
})
},
[CRUD.HOOK.afterToEdit]() {
// 获取入库单明细
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
crudMoreOrless.getMlDtl({'mol_id': this.form.mol_id}).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.isadd = false
row.edit = true
this.$set(row, 'edit', false)
this.form.tableData.splice(i, 1, row)
}
})
},
[CRUD.HOOK.afterToView]() {
this.mater_btn = true
crudMoreOrless.queryMolDetail({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
crudMoreOrless.getMlDtl({ 'mol_id': this.form.mol_id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.edit = true
this.$set(row, 'edit', true)
this.form.tableData.splice(i, 1, row)
}
})
@@ -385,13 +346,13 @@ export default {
return false
}
if (this.crud.status.add > 0) {
crudMoreOrless.getStructIvt({ 'struct_id': this.form.struct_id }).then(res => {
crudMoreOrless.getStructIvt({'struct_id': this.form.struct_id}).then(res => {
this.form.tableData = res
this.form.dtl_num = this.form.tableData.length
})
}
if (this.crud.status.edit > 0) {
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
crudMoreOrless.queryMolDtl({'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id}).then(res => {
this.form.tableData = res
this.form.dtl_num = this.form.tableData.length
})
@@ -399,17 +360,16 @@ export default {
},
tableChanged2(row) {
// 新增一行物料时,给行进行赋值
this.nowrow.material_code = row.material_code
this.nowrow.material_id = row.material_id
this.nowrow.material_name = row.material_name
this.nowrow.qty_unit_id = row.qty_unit_id
this.nowrow.qty_unit_name = row.qty_unit_name
this.nowrow.quality_scode = row.quality_scode
this.nowrow.is_active = row.is_active
this.nowrow.ivt_level = row.ivt_level
this.nowrow.pcsn = row.pcsn
this.nowrow.mol_qty = row.storage_qty
this.nowrow.bucketunique = row.bucketunique
this.$set(this.nowrow, 'material_code', row.material_code)
this.$set(this.nowrow, 'material_id', row.material_id)
this.$set(this.nowrow, 'material_name', row.material_name)
this.$set(this.nowrow, 'qty_unit_id', row.base_unit_id)
this.$set(this.nowrow, 'qty_unit_name', row.base_unit_name)
this.$set(this.nowrow, 'struct_id', this.form.struct_id)
this.$set(this.nowrow, 'struct_code', this.form.struct_code)
this.$set(this.nowrow, 'sect_id', this.form.sect_id)
this.$set(this.nowrow, 'sect_name', this.form.sect_name)
this.$set(this.nowrow, 'struct_name', this.form.struct_name)
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
tableChanged(row) {
@@ -418,8 +378,13 @@ export default {
this.form.sect_id = row.sect_id
this.form.sect_name = row.sect_name
this.form.struct_name = row.struct_name
crudMoreOrless.getStructIvt({ 'struct_id': row.struct_id }).then(res => {
crudMoreOrless.getStructIvt({'struct_id': row.struct_id}).then(res => {
this.form.tableData = res
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
this.$set(row, 'edit', false)
this.form.tableData.splice(i, 1, row)
}
this.form.dtl_num = this.form.tableData.length
})
},
@@ -443,7 +408,15 @@ export default {
this.nowrow = row
},
async insertdtl() {
this.form.tableData.push({ quality_scode: '02', ivt_qty: 0, mol_qty: 0, is_active: '1', ivt_level: '01', edit: false, is_add: true })
this.form.tableData.push({
quality_scode: '02',
ivt_qty: 0,
mol_qty: 0,
is_active: '1',
ivt_level: '01',
edit: false,
is_add: true
})
this.form.dtl_num = this.form.tableData.length
},
typeChange(val) {
@@ -461,7 +434,7 @@ export default {
},
handleEdit(index, row) {
if (!row.edit) {
if (parseFloat(row.mol_qty) <= 0) {
if (typeof (row.mol_qty) === 'undefined' | (parseFloat(row.mol_qty) <= 0)) {
this.crud.notify('不允许损溢数量为0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
@@ -469,18 +442,6 @@ export default {
this.crud.notify('物料不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.storagevehicle_code) {
this.crud.notify('载具号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.bucketunique) {
this.crud.notify('桶号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.pcsn) {
this.crud.notify('批次不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.mol_type === '0' && (parseFloat(row.ivt_qty) < parseFloat(row.mol_qty))) {
this.crud.notify('不允许损数量大于库存数量!', CRUD.NOTIFICATION_TYPE.INFO)
return false

View File

@@ -29,10 +29,11 @@
placeholder="输入货位编码、名称"
prefix-icon="el-icon-search"
class="filter-item"
/> </el-col>
/>
</el-col>
<el-col :span="6">
<rrOperation />
<rrOperation/>
</el-col>
</el-row>
<!--表格渲染-->
@@ -46,15 +47,15 @@
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="struct_code" label="货位编码" />
<el-table-column prop="struct_name" label="货位名称" />
<el-table-column prop="sect_name" label="库区名称" />
<el-table-column prop="lock_type" :formatter="lockFormat" label="是否锁定" />
<el-table-column prop="storagevehicle_code" label="存储载具号" />
<el-table-column type="selection" width="55"/>
<el-table-column prop="struct_code" label="货位编码"/>
<el-table-column prop="struct_name" label="货位名称"/>
<el-table-column prop="sect_name" label="库区名称"/>
<el-table-column prop="lock_type" :formatter="lockFormat" label="是否锁定"/>
<el-table-column prop="storagevehicle_code" label="存储载具号"/>
</el-table>
<!--分页组件-->
<pagination />
<pagination/>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
@@ -64,7 +65,7 @@
<script>
import CRUD, { 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'
@@ -73,7 +74,7 @@ import crudSectattr from '@/api/wms/basedata/st/sectattr'
export default {
name: 'StructDiv',
components: { crudOperation, rrOperation, pagination },
components: {crudOperation, rrOperation, pagination},
cruds() {
return CRUD({
title: '仓位',
@@ -81,8 +82,8 @@ export default {
url: 'api/structattr',
idField: 'struct_id',
sort: 'struct_id,desc',
query: { search: '', is_lock: '1', sect_id: '', stor_id: '' },
crudMethod: { ...crudStructattr }
query: {search: '', is_lock: '1', sect_id: '', stor_id: ''},
crudMethod: {...crudStructattr}
})
},
mixins: [presenter(), header()],
@@ -122,7 +123,7 @@ export default {
methods: {
open() {
this.crud.resetQuery(false)
crudSectattr.getSect({ 'is_materialstore': '1' }).then(res => {
crudSectattr.getSect({ 'stor_type': '3' }).then(res => {
this.sects = res.content
})
if (this.sect) {
@@ -192,22 +193,9 @@ export default {
return
}
// 溢单不允许选择已锁定或者有载具的货位
if (this.mol_type === '1') {
if (this.checkrow.lock_type !== '00') {
this.$message('溢单不允许选择已锁定的货位!')
return
}
}
// 损单不允许选择已锁定或者无载具的货位
if (this.mol_type === '0') {
if (this.checkrow.lock_type !== '00') {
this.$message('损单不允许选择已锁定的货位!')
return
}
if (this.checkrow.storagevehicle_code === '') {
this.$message('损单不允许选择无载具的货位!')
return
}
if (this.checkrow.lock_type !== '0') {
this.$message('不允许选择已锁定的货位!')
return
}
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.checkrow)

View File

@@ -11,12 +11,12 @@
label-width="80px"
label-suffix=":"
>
<el-form-item label="模糊查询">
<el-form-item label="单据编号">
<el-input
v-model="query.struct_search"
v-model="query.mol_code"
size="mini"
clearable
placeholder="货位编码、名称"
placeholder="单据编号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
@@ -69,7 +69,7 @@
<el-form-item label="单据状态">
<el-select
v-model="query.bill_status"
v-model="query.status"
clearable
size="mini"
placeholder="单据状态"
@@ -77,7 +77,7 @@
@change="crud.toQuery"
>
<el-option
v-for="item in dict.mol_bill_status"
v-for="item in dict.MOL_BILL_STATUS"
:key="item.value"
:label="item.label"
:value="item.value"
@@ -149,8 +149,8 @@
<el-table-column :formatter="stateFormat" min-width="100" prop="status" label="单据状态" />
<el-table-column label="备注" align="center" min-width="100" prop="remark" />
<el-table-column prop="create_mode" min-width="100" :formatter="create_modeFormat" label="生成方式" />
<el-table-column label="制单人" align="center" min-width="100" prop="input_optname" />
<el-table-column label="制单时间" align="center" prop="input_time" min-width="150" />
<el-table-column label="制单人" align="center" min-width="100" prop="create_name" />
<el-table-column label="制单时间" align="center" prop="create_time" min-width="150" />
<el-table-column label="确认人" align="center" prop="confirm_optname" min-width="150" />
<el-table-column label="确认时间" align="center" prop="confirm_time" min-width="150" />
</el-table>
@@ -170,10 +170,11 @@ import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index'
import AddDialog from '@/views/wms/storage_manage/product/productMoreOrless/AddDialog'
import { mapGetters } from 'vuex'
import crudStorattr from '@/api/wms/basedata/st/storattr'
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
import crudMoreOrless from '@/views/wms/storage_manage/product/productMoreOrless/moreorless'
export default {
name: 'MoreOrLess',
name: 'RawProductMl',
components: { AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
cruds() {
return CRUD({
@@ -184,13 +185,13 @@ export default {
size: 20
},
idField: 'mol_id',
url: '/api/instor/mol',
url: '/api/stIvtMoreorlessmstCp',
crudMethod: { ...crudMoreOrless }
})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['mol_bill_status', 'ST_CREATE_MODE', 'ST_MOL_TYPE'],
dicts: ['MOL_BILL_STATUS', 'ST_CREATE_MODE', 'ST_MOL_TYPE'],
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
@@ -217,7 +218,7 @@ export default {
}
},
created() {
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
crudStorattr.getStor({ 'stor_type': '3' }).then(res => {
this.storlist = res.content
})
},
@@ -266,7 +267,7 @@ export default {
}
},
stateFormat(row, column) {
return this.dict.label.mol_bill_status[row.status]
return this.dict.label.MOL_BILL_STATUS[row.status]
},
typeFormat(row, column) {
return this.dict.label.ST_MOL_TYPE[row.mol_type]

View File

@@ -2,7 +2,7 @@ import request from '@/utils/request'
export function add(data) {
return request({
url: '/api/instor/mol',
url: '/api/stIvtMoreorlessmstCp',
method: 'post',
data
})
@@ -10,50 +10,42 @@ export function add(data) {
export function del(ids) {
return request({
url: '/api/instor/mol',
method: 'delete',
url: '/api/stIvtMoreorlessmstCp/delete',
method: 'post',
data: ids
})
}
export function edit(data) {
return request({
url: '/api/instor/mol',
method: 'put',
url: '/api/stIvtMoreorlessmstCp/update',
method: 'post',
data
})
}
export function getStructIvt(params) {
return request({
url: '/api/instor/mol/getStructIvt',
method: 'get',
url: '/api/stIvtStructivtYl/getStructIvt',
method: 'post',
params
})
}
export function queryMolDtl(params) {
export function getMlDtl(data) {
return request({
url: '/api/instor/mol/queryMolDtl',
method: 'get',
params
})
}
export function queryMolDetail(params) {
return request({
url: '/api/instor/mol/queryMolDetail',
method: 'get',
params
})
}
export function confirm(data) {
return request({
url: '/api/instor/mol/confirm',
url: '/api/stIvtMoreorlessmstCp/getMlDtl',
method: 'post',
data
})
}
export default { add, edit, del, getStructIvt, queryMolDtl, queryMolDetail, confirm }
export function confirm(data) {
return request({
url: '/api/stIvtMoreorlessmstCp/confirm',
method: 'post',
data
})
}
export default { add, edit, del, getStructIvt, getMlDtl, confirm }

View File

@@ -1,524 +0,0 @@
<template>
<el-dialog
:title="crud.status.title"
append-to-body
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
fullscreen
width="1200px"
@open="open"
@close="close"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
<el-form-item label="单据号" prop="bill_code">
<label slot="label">单&nbsp;&nbsp;据&nbsp;号:</label>
<el-input v-model.trim="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
</el-form-item>
<el-form-item label="仓库" prop="stor_id">
<label slot="label">仓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;库:</label>
<el-select
v-model="form.stor_id"
clearable
placeholder="仓库"
class="filter-item"
style="width: 210px"
:disabled="crud.status.view > 0"
>
<el-option
v-for="item in storlist"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item>
<el-form-item label="损溢类型" prop="mol_type">
<el-select
v-model="form.mol_type"
style="width: 210px"
clearable
class="filter-item"
:disabled="crud.status.view > 0"
@change="typeChange"
>
<el-option
v-for="item in dict.ST_MOL_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="货位" prop="struct_code">
<label slot="label">货&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位:</label>
<el-input v-model.trim="form.struct_code" style="width: 210px" disabled placeholder="选择货位">
<el-button v-show="crud.status.view <= 0" slot="append" icon="el-icon-plus" @click="queryStruct()" />
</el-input>
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
<el-input v-model.trim="form.dtl_num" size="mini" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="总重量" prop="total_qty">
<label slot="label">总&nbsp;&nbsp;重&nbsp;量:</label>
<el-input-number
v-model="form.total_qty"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model.trim="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
</el-form-item>
</el-form>
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<!--<el-button
slot="left"
class="filter-item"
type="warning"
icon="el-icon-search"
size="mini"
:disabled="crud.status.view > 0"
@click="resetTable()"
>
重置表格
</el-button>-->
<el-button
slot="left"
class="filter-item"
type="warning"
icon="el-icon-check"
size="mini"
:disabled="mater_btn"
@click="insertdtl()"
>
新增一行
</el-button>
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="form.tableData"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具号" align="center" width="150px">
<template scope="scope">
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.storagevehicle_code" size="mini" />
<span v-show="scope.row.edit">{{ scope.row.storagevehicle_code }}</span>
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.storagevehicle_code }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="bucketunique" label="桶号" width="190" align="center">
<template scope="scope">
<el-input v-show="!scope.row.edit && scope.row.is_add" v-model="scope.row.bucketunique" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-plus" @click="queryBucket(scope.$index, scope.row)" />
</el-input>
<span v-show="scope.row.edit">{{ scope.row.bucketunique }}</span>
<span v-show="!scope.row.edit && !scope.row.is_add">{{ scope.row.bucketunique }}</span>
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码" align="center" min-width="200" show-overflow-tooltip />
<el-table-column prop="material_name" label="物料名称" align="center" min-width="200" show-overflow-tooltip />
<el-table-column prop="pcsn" label="批次号" align="center" min-width="200" show-overflow-tooltip />
<el-table-column prop="quality_scode" label="品质类型" align="center" width="150px">
<template slot-scope="scope">
<el-select
v-model="scope.row.quality_scode"
size="mini"
clearable
class="filter-item"
disabled
>
<el-option
v-for="item in dict.ST_QUALITY_SCODE"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="ivt_level" label="库存等级" align="center" width="150px">
<template slot-scope="scope">
<el-select
v-model="scope.row.ivt_level"
size="mini"
clearable
class="filter-item"
placeholder=""
disabled
>
<el-option
v-for="item in dict.ST_IVT_LEVEL"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="is_active" label="是否可用" align="center" width="150px">
<template slot-scope="scope">
<el-select
v-model="scope.row.is_active"
size="mini"
clearable
class="filter-item"
placeholder=""
disabled
>
<el-option
v-for="item in dict.is_used"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="ivt_qty" label="库存重量" align="center" :formatter="crud.formatNum3" />
<el-table-column prop="mol_qty" width="220" label="损溢重量" align="center">
<template scope="scope">
<el-input-number v-model="scope.row.mol_qty" :disabled="scope.row.edit" :precision="3" :controls="false" :min="0" style="width: 120px" />
</template>
</el-table-column>
<el-table-column prop="qty_unit_name" label="单位" align="center" />
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="190" fixed="right">
<template scope="scope">
<el-button
type="danger"
class="filter-item"
size="mini"
icon="el-icon-delete"
@click.native.prevent="deleteRow(scope.$index, form.tableData)"
/>
<el-button
v-show="!scope.row.edit"
type="primary"
class="filter-item"
size="mini"
icon="el-icon-edit"
@click="handleEdit(scope.$index, scope.row)"
>编辑
</el-button>
<el-button
v-show="scope.row.edit"
type="success"
class="filter-item"
size="mini"
icon="el-icon-check"
@click="handleEdit(scope.$index, scope.row)"
>完成
</el-button>
</template>
</el-table-column>
</el-table>
<MaterDtl :dialog-show.sync="materShow" :dialog-matertype="materType" @tableChanged2="tableChanged2" />
<StructDiv ref="child" :dialog-show.sync="structShow" @tableChanged="tableChanged" />
<BucketDialog :dialog-show.sync="bucketShow" @bucketChange="tableChanged2" />
</el-dialog>
</template>
<script>
import crudOperation from '@crud/CRUD.operation'
import BucketDialog from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/NewBucketDialog'
import CRUD, { crud, form } from '@crud/crud'
import crudStorattr from '@/api/wms/basedata/st/storattr'
import crudMoreOrless from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/moreorless'
import MaterDtl from '@/views/wms/pub/MaterDialog'
import StructDiv from '@/views/wms/storage_manage/semiproduct/semiproductMoreOrless/StructDiv'
const defaultForm = {
mol_id: '',
mol_code: '',
mol_type: '',
stor_id: '',
total_qty: '0',
dtl_num: '0',
bill_type: '',
remark: '',
struct_id: '',
sect_id: '',
sect_name: '',
struct_code: '',
struct_name: '',
tableData: []
}
export default {
name: 'AddDialog',
components: { crudOperation, MaterDtl, StructDiv, BucketDialog },
mixins: [crud(), form(defaultForm)],
dicts: ['io_bill_status', 'ST_QUALITY_SCODE', 'ST_IVT_LEVEL', 'is_used', 'ST_MOL_TYPE'],
props: {
dialogShow: {
type: Boolean,
default: false
},
bussConfig: {
type: Object
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
materShow: false,
bucketShow: false,
structShow: false,
materType: '',
mater_btn: true,
storlist: [],
rules: {
stor_id: [
{ required: true, message: '仓库不能为空', trigger: 'blur' }
],
bill_type: [
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
],
biz_date: [
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
}
},
methods: {
open() {
// 查询原材料库的仓库
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
this.storlist = res.content
})
},
[CRUD.HOOK.afterToEdit]() {
// 获取入库单明细
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.isadd = false
row.edit = true
this.form.tableData.splice(i, 1, row)
}
})
},
[CRUD.HOOK.afterToView]() {
this.mater_btn = true
crudMoreOrless.queryMolDetail({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.edit = true
this.form.tableData.splice(i, 1, row)
}
})
},
close() {
this.$emit('AddChanged')
},
[CRUD.HOOK.beforeSubmit]() {
debugger
// 提交前校验
if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
for (let i = 0; i < this.form.tableData.length; i++) {
if (!this.form.tableData[i].edit) {
this.crud.notify('尚有未完成编辑的物料明细序号' + (i + 1) + ',请检查!')
return false
}
const vehicle_code = this.form.tableData[i].storagevehicle_code
const same = this.form.tableData.some(mater => mater.storagevehicle_code !== vehicle_code)
if (same) {
this.crud.notify('存在不同载具号', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
},
billTypeChange(val) {
this.form.tableData = []
this.form.total_qty = 0
this.form.dtl_num = 0
},
resetTable() {
if (!this.form.struct_id) {
this.crud.notify('请先选择货物!')
return false
}
if (this.crud.status.add > 0) {
crudMoreOrless.getStructIvt({ 'struct_id': this.form.struct_id }).then(res => {
this.form.tableData = res
this.form.dtl_num = this.form.tableData.length
})
}
if (this.crud.status.edit > 0) {
crudMoreOrless.queryMolDtl({ 'mol_id': this.form.mol_id, 'struct_id': this.form.struct_id }).then(res => {
this.form.tableData = res
this.form.dtl_num = this.form.tableData.length
})
}
},
tableChanged2(row) {
// 新增一行物料时,给行进行赋值
this.nowrow.material_code = row.material_code
this.nowrow.material_id = row.material_id
this.nowrow.material_name = row.material_name
this.nowrow.qty_unit_id = row.qty_unit_id
this.nowrow.qty_unit_name = row.qty_unit_name
this.nowrow.quality_scode = row.quality_scode
this.nowrow.is_active = row.is_active
this.nowrow.ivt_level = row.ivt_level
this.nowrow.pcsn = row.pcsn
this.nowrow.mol_qty = row.storage_qty
this.nowrow.bucketunique = row.bucketunique
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
tableChanged(row) {
this.form.struct_id = row.struct_id
this.form.struct_code = row.struct_code
this.form.sect_id = row.sect_id
this.form.sect_name = row.sect_name
this.form.struct_name = row.struct_name
crudMoreOrless.getStructIvt({ 'struct_id': row.struct_id }).then(res => {
this.form.tableData = res
this.form.dtl_num = this.form.tableData.length
})
},
async queryMater(index, row) {
this.materShow = true
this.nowindex = index
this.nowrow = row
},
async queryStruct() {
if (!this.form.mol_type) {
this.crud.notify('请先选择损溢类型!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.structShow = true
this.$refs.child.getMsg(this.form.mol_type)
},
async queryBucket(index, row) {
this.bucketShow = true
this.nowindex = index
this.nowrow = row
},
async insertdtl() {
this.form.tableData.push({ quality_scode: '02', ivt_qty: 0, mol_qty: 0, is_active: '1', ivt_level: '01', edit: false, is_add: true })
this.form.dtl_num = this.form.tableData.length
},
typeChange(val) {
if (val === '1') {
this.mater_btn = false
} else {
this.mater_btn = true
}
this.form.tableData = []
this.form.struct_id = ''
this.form.struct_code = ''
this.form.sect_id = ''
this.form.sect_name = ''
this.form.struct_name = ''
},
handleEdit(index, row) {
if (!row.edit) {
if (parseFloat(row.mol_qty) <= 0) {
this.crud.notify('不允许损溢数量为0', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.material_id) {
this.crud.notify('物料不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.storagevehicle_code) {
this.crud.notify('载具号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.bucketunique) {
this.crud.notify('桶号不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (!row.pcsn) {
this.crud.notify('批次不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (this.form.mol_type === '0' && (parseFloat(row.ivt_qty) < parseFloat(row.mol_qty))) {
this.crud.notify('不允许损数量大于库存数量!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
// 修改行的编辑状态
row.edit = !row.edit
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
if (row.edit) {
this.form.total_qty = 0
this.form.tableData.forEach((item) => {
this.form.total_qty = this.form.total_qty + item.mol_qty
})
}
},
deleteRow(index, rows) {
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].mol_qty)
rows.splice(index, 1)
this.form.dtl_num = this.form.tableData.length
}
}
}
</script>
<style>
.crud-opts2 {
padding: 4px 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>