fix:原材料入库
This commit is contained in:
@@ -75,7 +75,7 @@ public class SectattrController {
|
||||
@GetMapping("/getSect")
|
||||
@Log("查询库区下拉框")
|
||||
@ApiOperation("查询库区下拉框")
|
||||
public ResponseEntity<Object> querySect(@RequestParam JSONObject query) {
|
||||
public ResponseEntity<Object> querySect(@RequestBody(required = false) JSONObject query) {
|
||||
List<Map> list = isectattrService.getSect(query);
|
||||
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package org.nl.wms.masterdata_manage.storage.controller.storage;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -40,8 +41,14 @@ public class StorattrController {
|
||||
@PostMapping("/queryStor")
|
||||
@Log("查询仓库")
|
||||
@ApiOperation("查询仓库")
|
||||
public ResponseEntity<Object> queryStor() {
|
||||
List<StIvtBsrealstorattr> list = stIvtBsrealstorattrService.list(new QueryWrapper<StIvtBsrealstorattr>().eq("is_used", true));
|
||||
public ResponseEntity<Object> queryStor(@RequestBody JSONObject jo) {
|
||||
String stor_type = jo.getString("stor_type");
|
||||
QueryWrapper<StIvtBsrealstorattr> queryWrapper = new QueryWrapper<>();
|
||||
if (StrUtil.isNotEmpty(stor_type)){
|
||||
queryWrapper.eq("stor_type",stor_type);
|
||||
}
|
||||
queryWrapper.eq("is_used", true);
|
||||
List<StIvtBsrealstorattr> list = stIvtBsrealstorattrService.list(queryWrapper);
|
||||
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author zhouz
|
||||
* @date 2021-12-09
|
||||
**/
|
||||
* @author zhouz
|
||||
* @date 2021-12-09
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "仓位管理")
|
||||
@@ -38,16 +38,16 @@ public class StructattrController {
|
||||
@Log("查询仓位")
|
||||
@ApiOperation("查询仓位")
|
||||
//@PreAuthorize("@el.check('structattr:list')")
|
||||
public ResponseEntity<Object> queryAll(StructarrQuery query, PageQuery page){
|
||||
public ResponseEntity<Object> queryAll(StructarrQuery query, PageQuery page) {
|
||||
Page<StIvtStructattr> list = ivtStructattrService.page(page.build(StIvtStructattr.class), query.build());
|
||||
return new ResponseEntity<>(TableDataInfo.build(list),HttpStatus.OK);
|
||||
return new ResponseEntity<>(TableDataInfo.build(list), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增仓位")
|
||||
@ApiOperation("新增仓位")
|
||||
//@PreAuthorize("@el.check('structattr:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody JSONObject form){
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody JSONObject form) {
|
||||
ivtStructattrService.create(form);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class StructattrController {
|
||||
@Log("修改仓位")
|
||||
@ApiOperation("修改仓位")
|
||||
//@PreAuthorize("@el.check('structattr:edit')")
|
||||
public ResponseEntity<Object> updateForm(@Validated @RequestBody JSONObject form){
|
||||
public ResponseEntity<Object> updateForm(@Validated @RequestBody JSONObject form) {
|
||||
ivtStructattrService.updateForm(form);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public class StructattrController {
|
||||
//@PreAuthorize("@el.check('structattr:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
if (ids != null && ids.length>0){
|
||||
if (ids != null && ids.length > 0) {
|
||||
ivtStructattrService.removeByIds(Arrays.asList(ids));
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
@@ -79,4 +79,11 @@ public class StructattrController {
|
||||
ivtStructattrService.changeActive(json);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/getSectCascader")
|
||||
@Log("查询联级仓位")
|
||||
@ApiOperation("查询联级仓位")
|
||||
public ResponseEntity<Object> getSectCascader(@RequestBody JSONObject json) {
|
||||
return new ResponseEntity<>(ivtStructattrService.getSectCascader(json),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,10 @@ public interface IStIvtStructattrService extends IService<StIvtStructattr> {
|
||||
* @param json
|
||||
*/
|
||||
void changeActive(JSONObject json);
|
||||
|
||||
/**
|
||||
* 查询库区下的仓位
|
||||
* @param jo
|
||||
*/
|
||||
JSONObject getSectCascader(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -4,43 +4,43 @@
|
||||
|
||||
<select id="getSectByStorQuery" resultType="java.util.Map">
|
||||
SELECT
|
||||
st_ivt_sectattr.sect_name,
|
||||
st_ivt_sectattr.sect_id,
|
||||
st_ivt_sectattr.sect_code,
|
||||
st_ivt_bsrealstorattr.stor_name,
|
||||
st_ivt_bsrealstorattr.stor_id,
|
||||
st_ivt_bsrealstorattr.stor_code
|
||||
sect.sect_name,
|
||||
sect.sect_id,
|
||||
sect.sect_code,
|
||||
stor.stor_name,
|
||||
stor.stor_id,
|
||||
stor.stor_code
|
||||
FROM
|
||||
st_ivt_sectattr
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON st_ivt_sectattr.stor_id = stor.stor_id
|
||||
st_ivt_sectattr sect
|
||||
LEFT JOIN st_ivt_bsrealstorattr stor ON sect.stor_id = stor.stor_id
|
||||
WHERE
|
||||
stor.is_used = '1'
|
||||
<if test="is_virtualstore != null and is_virtualstore != ''">
|
||||
and stor.is_virtualstore = #{is_virtualstore}
|
||||
</if>
|
||||
<if test="is_semi_finished != null and is_semi_finished != ''">
|
||||
and stor.is_semi_finished = #{is_semi_finished}
|
||||
</if>
|
||||
<if test="is_productstore != null and is_productstore != ''">
|
||||
and stor.is_productstore = #{is_productstore}
|
||||
</if>
|
||||
<if test="is_attachment != null and is_attachment != ''">
|
||||
and stor.is_attachment = #{is_attachment}
|
||||
</if>
|
||||
<if test="is_reversed != null and is_reversed != ''">
|
||||
and stor.is_reversed = #{is_reversed}
|
||||
</if>
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and stor.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and stor.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and stor.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="sect_type_attr != null and stor_id != ''">
|
||||
and st_ivt_sectattr.sect_type_attr = #{sect_type_attr}
|
||||
</if>
|
||||
stor.is_used = '1'
|
||||
<if test="is_virtualstore != null and is_virtualstore != ''">
|
||||
and stor.is_virtualstore = #{is_virtualstore}
|
||||
</if>
|
||||
<if test="is_semi_finished != null and is_semi_finished != ''">
|
||||
and stor.is_semi_finished = #{is_semi_finished}
|
||||
</if>
|
||||
<if test="is_productstore != null and is_productstore != ''">
|
||||
and stor.is_productstore = #{is_productstore}
|
||||
</if>
|
||||
<if test="is_attachment != null and is_attachment != ''">
|
||||
and stor.is_attachment = #{is_attachment}
|
||||
</if>
|
||||
<if test="is_reversed != null and is_reversed != ''">
|
||||
and stor.is_reversed = #{is_reversed}
|
||||
</if>
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and stor.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and stor.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and stor.stor_id = #{stor_id}
|
||||
</if>
|
||||
<if test="sect_type_attr != null and stor_id != ''">
|
||||
and st_ivt_sectattr.sect_type_attr = #{sect_type_attr}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.nl.wms.masterdata_manage.storage.service.storage.impl;
|
||||
|
||||
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;
|
||||
@@ -11,7 +13,6 @@ import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.IStIvtBsrealstorattrService;
|
||||
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.StIvtBsrealstorattr;
|
||||
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.masterdata_manage.storage.service.storage.dao.mapper.StIvtStructattrMapper;
|
||||
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -35,6 +37,8 @@ public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMappe
|
||||
private IStIvtSectattrService sectattrService;
|
||||
@Autowired
|
||||
private IStIvtBsrealstorattrService storattrService;
|
||||
@Autowired
|
||||
private IStIvtStructattrService structattrService;
|
||||
|
||||
@Override
|
||||
public String create(JSONObject form) {
|
||||
@@ -81,6 +85,38 @@ public class StIvtStructattrServiceImpl extends ServiceImpl<StIvtStructattrMappe
|
||||
return structattr.getStruct_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getSectCascader(JSONObject jo) {
|
||||
String stor_id = jo.getString("stor_id");
|
||||
if (StrUtil.isEmpty(stor_id)) {
|
||||
stor_id = "";
|
||||
}
|
||||
JSONArray cascader_ja = new JSONArray();
|
||||
List<StIvtSectattr> list = sectattrService.list(new QueryWrapper<StIvtSectattr>().eq("is_used", true)
|
||||
.eq("stor_id", stor_id));
|
||||
list.forEach(sect -> {
|
||||
JSONObject sect_cas = new JSONObject();
|
||||
sect_cas.put("value", sect.getSect_id());
|
||||
sect_cas.put("label", sect.getSect_name());
|
||||
List<StIvtStructattr> struct_list = structattrService.list(new QueryWrapper<StIvtStructattr>().eq("is_used", true)
|
||||
.eq("sect_id", sect.getSect_id()));
|
||||
if (struct_list.size() > 0) {
|
||||
JSONArray struct_ja = new JSONArray();
|
||||
struct_list.forEach(struct -> {
|
||||
JSONObject struct_cas = new JSONObject();
|
||||
struct_cas.put("value", struct.getStruct_id());
|
||||
struct_cas.put("label", struct.getStruct_name());
|
||||
struct_ja.add(struct_cas);
|
||||
});
|
||||
sect_cas.put("children", struct_ja);
|
||||
}
|
||||
cascader_ja.add(sect_cas);
|
||||
});
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("content", cascader_ja);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeActive(JSONObject form) {
|
||||
Assert.notNull(form,"请求参数不能为空");
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package org.nl.wms.pcs_manage;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 20:11
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum PCSEnum {
|
||||
//单据状态
|
||||
BILL_STATUS(MapOf.of("生成", "10", "提交", "20", "确认采购", "30", "到货中", "40", "完成", "99")),
|
||||
|
||||
;
|
||||
private Map<String, String> code;
|
||||
|
||||
public String code(String desc) {
|
||||
String code = this.getCode().get(desc);
|
||||
if (StringUtils.isNotEmpty(code)) {
|
||||
return code;
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + desc + "未定义");
|
||||
}
|
||||
|
||||
public String check(String code) {
|
||||
for (Map.Entry<String, String> entry : this.getCode().entrySet()) {
|
||||
if (entry.getValue().equals("code")) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
throw new BadRequestException(this.name() + "对应类型" + code + "未定义");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.wms.pcs_manage.controller.purchase;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
||||
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||
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;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 原材料需求表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/pcsIfPurchaseorder")
|
||||
public class PcsIfPurchaseorderController {
|
||||
|
||||
@Autowired
|
||||
private IPcsIfPurchaseorderService purchaseorderService;
|
||||
|
||||
@GetMapping(value = "/forRawIn")
|
||||
@Log("查询需入库的原料需求")
|
||||
@ApiOperation("查询需入库的原料需求")
|
||||
public ResponseEntity<Object> queryRawIn(PurchaseOrderQuery query, PageQuery page){
|
||||
return new ResponseEntity<>(purchaseorderService.queryRawIn(query,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package org.nl.wms.pcs_manage.service.purchase;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 原材料需求表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-15
|
||||
*/
|
||||
public interface IPcsIfPurchaseorderService extends IService<PcsIfPurchaseorder> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param query,page /
|
||||
* @return JSONObject
|
||||
*/
|
||||
Object queryRawIn(PurchaseOrderQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 修改原料需求表的入库数量并修改状态
|
||||
*
|
||||
* @param jo /
|
||||
*/
|
||||
void updatePurchaseNum(JSONObject jo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package org.nl.wms.pcs_manage.service.purchase.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 原材料需求表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-15
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("pcs_if_purchaseorder")
|
||||
public class PcsIfPurchaseorder implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 车间标识
|
||||
*/
|
||||
private String workshop_id;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private BigDecimal qty;
|
||||
|
||||
/**
|
||||
* 安全库存数量
|
||||
*/
|
||||
private BigDecimal safe_qty;
|
||||
|
||||
/**
|
||||
* 总数量
|
||||
*/
|
||||
private BigDecimal total_qty;
|
||||
|
||||
/**
|
||||
* 数量计量单位标识
|
||||
*/
|
||||
private String qty_unit_id;
|
||||
|
||||
/**
|
||||
* 数量计量单位名称
|
||||
*/
|
||||
private String qty_unit_name;
|
||||
|
||||
/**
|
||||
* 要求到料日期
|
||||
*/
|
||||
private String ask_time;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String po_code;
|
||||
|
||||
/**
|
||||
* 确认到料日期
|
||||
*/
|
||||
private String agree_time;
|
||||
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
private String apply_name;
|
||||
|
||||
/**
|
||||
* 入库数量
|
||||
*/
|
||||
private BigDecimal instor_qty;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private String STATUS;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 提交人
|
||||
*/
|
||||
private String audit_optid;
|
||||
|
||||
/**
|
||||
* 提交时间
|
||||
*/
|
||||
private String audit_time;
|
||||
|
||||
/**
|
||||
* 提交人姓名
|
||||
*/
|
||||
private String audit_optname;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
*/
|
||||
private String confirm_optid;
|
||||
|
||||
/**
|
||||
* 确认人姓名
|
||||
*/
|
||||
private String confirm_optname;
|
||||
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private Boolean is_delete;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private String sysdeptid;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
private String syscompanyid;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.pcs_manage.service.purchase.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.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 原材料需求表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-15
|
||||
*/
|
||||
public interface PcsIfPurchaseorderMapper extends BaseMapper<PcsIfPurchaseorder> {
|
||||
|
||||
List<Map> getMstDetail(@Param("query") PurchaseOrderQuery query, @Param(value = "pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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.pcs_manage.service.purchase.dao.mapper.PcsIfPurchaseorderMapper">
|
||||
|
||||
<select id="getMstDetail" resultType="java.util.Map">
|
||||
SELECT
|
||||
po.ask_time,
|
||||
po.po_code,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
class.class_name,
|
||||
po.total_qty,
|
||||
po.total_qty - po.instor_qty AS need_qty,
|
||||
po.qty_unit_name,
|
||||
po.qty_unit_id,
|
||||
po.material_id
|
||||
FROM
|
||||
pcs_if_purchaseorder po
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = po.material_id
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
<where>
|
||||
po.status = '30'
|
||||
<if test="query.start_time != null">
|
||||
and po.ask_time >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null">
|
||||
and #{query.end_time} >= po.ask_time
|
||||
</if>
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
and mst.bill_code = #{query.bill_code}
|
||||
</if>
|
||||
<if test="query.material_search != null and query.material_search != ''">
|
||||
and (mb.material_code = #{query.material_search} OR mb.material_name = #{query.material_search})
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
package org.nl.wms.pcs_manage.service.purchase.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.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 19:49
|
||||
*/
|
||||
@Data
|
||||
public class PurchaseOrderQuery extends BaseQuery<PcsIfPurchaseorder> {
|
||||
|
||||
|
||||
private String bill_code;
|
||||
|
||||
private String material_search;
|
||||
|
||||
private Boolean is_delete = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("bill_code", QParam.builder().k(new String[]{"bill_code"}).type(QueryTEnum.LK).build());
|
||||
super.doP.put("material_search", QParam.builder().k(new String[]{"material_search"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.nl.wms.pcs_manage.service.purchase.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.pcs_manage.PCSEnum;
|
||||
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dao.mapper.PcsIfPurchaseorderMapper;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
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>
|
||||
* 原材料需求表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-15
|
||||
*/
|
||||
@Service
|
||||
public class PcsIfPurchaseorderServiceImpl extends ServiceImpl<PcsIfPurchaseorderMapper, PcsIfPurchaseorder> implements IPcsIfPurchaseorderService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PcsIfPurchaseorderMapper purchaseorderMapper;
|
||||
|
||||
@Override
|
||||
public Object queryRawIn(PurchaseOrderQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
List<Map> mst_detail = purchaseorderMapper.getMstDetail(query, pageQuery);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePurchaseNum(JSONObject jo) {
|
||||
String po_code = jo.getString("po_code");
|
||||
double instor_qty = jo.getDoubleValue("instor_qty");
|
||||
if (StrUtil.isEmpty(po_code)) {
|
||||
throw new BadRequestException("原料需求的订单编号不能为空!");
|
||||
}
|
||||
if (instor_qty <= 0) {
|
||||
throw new BadRequestException("入库数量必须大于0!");
|
||||
}
|
||||
PcsIfPurchaseorder purchaseorder = this.getOne(new QueryWrapper<PcsIfPurchaseorder>().eq("po_code", po_code));
|
||||
|
||||
if (purchaseorder.getSTATUS().equals(PCSEnum.BILL_STATUS.code("确认"))) {
|
||||
throw new BadRequestException("当前单据状态已经完成,无法进行入库数修改!");
|
||||
}
|
||||
|
||||
BigDecimal new_instor_qty = NumberUtil.add(instor_qty, purchaseorder.getInstor_qty(), 3);
|
||||
if (purchaseorder.getTotal_qty().compareTo(new_instor_qty) <= 0) {
|
||||
purchaseorder.setSTATUS(PCSEnum.BILL_STATUS.code("完成"));
|
||||
purchaseorder.setConfirm_optid(SecurityUtils.getCurrentUserId());
|
||||
purchaseorder.setConfirm_optname(SecurityUtils.getCurrentNickName());
|
||||
purchaseorder.setConfirm_time(DateUtil.now());
|
||||
} else {
|
||||
purchaseorder.setSTATUS(PCSEnum.BILL_STATUS.code("到货中"));
|
||||
}
|
||||
this.updateById(purchaseorder);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,8 @@ public enum IOSEnum {
|
||||
//出入库类型
|
||||
IO_TYPE(MapOf.of("入库", "1", "出库", "2")),
|
||||
//单据类型
|
||||
BILL_TYPE(MapOf.of("生产入库", "1", "手工入库", "2")),
|
||||
BILL_TYPE(MapOf.of("生产入库", "11", "手工入库", "12", "原料入库", "13"
|
||||
, "领料出库", "21", "销售出库", "22", "手工出库", "23")),
|
||||
//单据状态
|
||||
BILL_STATUS(MapOf.of("生成", "10", "分配中", "20", "分配完", "30", "完成", "99")),
|
||||
//单据状态
|
||||
|
||||
@@ -34,8 +34,8 @@ public class StIvtIostorinvYlController {
|
||||
private IStIvtIostorinvYlService iostorinvYlService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询入库单")
|
||||
@ApiOperation("查询入库单")
|
||||
@Log("查询原料入库单")
|
||||
@ApiOperation("查询原料入库单")
|
||||
public ResponseEntity<Object> query(YlIostorInvQuery query, PageQuery page){
|
||||
return new ResponseEntity<>(iostorinvYlService.pageQuery(query,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.controller.iostorInv;
|
||||
|
||||
|
||||
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.rawmanage.service.iostorInv.IStIvtIostorinvOutYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/out/stIvtIostorinvYl")
|
||||
public class StIvtIostorinvYlOutController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtIostorinvOutYlService iostorinvOutYlService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询原料出库单")
|
||||
@ApiOperation("查询原料出库单")
|
||||
public ResponseEntity<Object> query(YlIostorInvQuery query, PageQuery page){
|
||||
return new ResponseEntity<>(iostorinvOutYlService.pageQuery(query,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("创建入库单")
|
||||
@ApiOperation("创建入库单")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||
iostorinvOutYlService.create(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Log("修改入库单")
|
||||
@ApiOperation("修改入库单")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||
iostorinvOutYlService.updateBill(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@Log("删除入库单")
|
||||
@ApiOperation("删除入库单")
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids){
|
||||
iostorinvOutYlService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getIODtl")
|
||||
@Log("查询入库分配明细")
|
||||
@ApiOperation("查询入库分配明细")
|
||||
public ResponseEntity<Object> getIODtl(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(iostorinvOutYlService.getInvDtl(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirm")
|
||||
@Log("强制确认")
|
||||
@ApiOperation("强制确认")
|
||||
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
|
||||
iostorinvOutYlService.confirm(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.controller.structIvt;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.IStIvtStructivtYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dto.StructIvtYLQuery;
|
||||
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 +22,17 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/stIvtStructivtYl")
|
||||
@RequestMapping("/api/stIvtStructivtYl")
|
||||
public class StIvtStructivtYlController {
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtYlService structivtYlService;
|
||||
|
||||
@GetMapping("/getRawIvt")
|
||||
@Log("查询可用的原料库存")
|
||||
@ApiOperation("查询可用的原料库存")
|
||||
public ResponseEntity<Object> getRawIvt(StructIvtYLQuery query, PageQuery page){
|
||||
return new ResponseEntity<>(structivtYlService.getRawIvt(query,page), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.iostorInv;
|
||||
|
||||
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.rawmanage.service.iostorInv.dao.StIvtIostorinvYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
public interface IStIvtIostorinvOutYlService extends IService<StIvtIostorinvYl> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param query,page /
|
||||
* @return JSONObject
|
||||
*/
|
||||
Object pageQuery(YlIostorInvQuery query, PageQuery page);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param form /
|
||||
*/
|
||||
void create(JSONObject form);
|
||||
|
||||
/**
|
||||
* 修改单据
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
String updateBill(JSONObject form);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids
|
||||
* {
|
||||
* 主表id..
|
||||
* }
|
||||
*/
|
||||
void delete(Long[] ids);
|
||||
|
||||
/**
|
||||
* 获取分配明细
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
List<Map> getInvDtl(JSONObject form);
|
||||
|
||||
/**
|
||||
* 强制确认
|
||||
* @param form
|
||||
* @return
|
||||
*/
|
||||
void confirm(JSONObject form);
|
||||
|
||||
}
|
||||
@@ -1,17 +1,13 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表
|
||||
@@ -121,8 +117,7 @@ public class StIvtIostorinvYl implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date create_time;
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
@@ -137,8 +132,7 @@ public class StIvtIostorinvYl implements Serializable {
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date update_time;
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 分配人
|
||||
@@ -153,8 +147,7 @@ public class StIvtIostorinvYl implements Serializable {
|
||||
/**
|
||||
* 分配时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date dis_time;
|
||||
private String dis_time;
|
||||
|
||||
/**
|
||||
* 确认人
|
||||
@@ -169,7 +162,7 @@ public class StIvtIostorinvYl implements Serializable {
|
||||
/**
|
||||
* 确认时间
|
||||
*/
|
||||
private Date confirm_time;
|
||||
private String confirm_time;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
@@ -204,7 +197,7 @@ public class StIvtIostorinvYl implements Serializable {
|
||||
/**
|
||||
* 回传时间
|
||||
*/
|
||||
private Date upload_time;
|
||||
private String upload_time;
|
||||
|
||||
/**
|
||||
* 车间标识
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -27,6 +28,7 @@ public class StIvtIostorinvdisYl implements Serializable {
|
||||
/**
|
||||
* 出入单分配标识
|
||||
*/
|
||||
@TableId(value = "iostorinvdis_id")
|
||||
private String iostorinvdis_id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
@@ -24,6 +26,7 @@ public class StIvtIostorinvdtlYl implements Serializable {
|
||||
/**
|
||||
* 出入单明细标识
|
||||
*/
|
||||
@TableId(value = "iostorinvdtl_id")
|
||||
private String iostorinvdtl_id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.iostorInv.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.rawmanage.service.iostorInv.dao.StIvtIostorinvYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
public interface StIvtIostorinvOutYlMapper extends BaseMapper<StIvtIostorinvYl> {
|
||||
|
||||
List<Map> getMstDetail(@Param("query") YlIostorInvQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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.rawmanage.service.iostorInv.dao.mapper.StIvtIostorinvOutYlMapper">
|
||||
|
||||
<select id="getMstDetail" resultType="java.util.Map">
|
||||
SELECT DISTINCT
|
||||
mst.iostorinv_id,
|
||||
mst.bill_code,
|
||||
mst.io_type,
|
||||
mst.buss_type,
|
||||
mst.bill_type,
|
||||
mst.biz_date,
|
||||
mst.stor_id,
|
||||
mst.stor_code,
|
||||
mst.stor_name,
|
||||
mst.source_id,
|
||||
mst.source_name,
|
||||
mst.source_type,
|
||||
mst.total_qty,
|
||||
mst.detail_count,
|
||||
mst.bill_status,
|
||||
mst.remark,
|
||||
mst.create_id,
|
||||
mst.create_name,
|
||||
DATE_FORMAT( mst.create_time,'%Y-%m-%d %H:%i:%s') AS create_time,
|
||||
mst.update_id,
|
||||
mst.update_name,
|
||||
DATE_FORMAT( mst.update_time,'%Y-%m-%d %H:%i:%s') AS update_time,
|
||||
mst.confirm_id,
|
||||
mst.confirm_name,
|
||||
DATE_FORMAT( mst.confirm_time,'%Y-%m-%d %H:%i:%s') AS confirm_time,
|
||||
dis.struct_id,
|
||||
dis.sect_id
|
||||
FROM
|
||||
st_ivt_iostorinv_yl mst
|
||||
LEFT JOIN st_ivt_iostorinvdis_yl dis ON dis.iostorinv_id = mst.iostorinv_id
|
||||
<where>
|
||||
mst.is_delete = '0'
|
||||
AND
|
||||
io_type = '2'
|
||||
<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.bill_status != null and query.bill_status != ''">
|
||||
and mst.bill_status = #{query.bill_status}
|
||||
</if>
|
||||
<if test="query.bill_type != null and query.bill_type != ''">
|
||||
and mst.bill_type = #{query.bill_type}
|
||||
</if>
|
||||
<if test="query.bill_code != null and query.bill_code != ''">
|
||||
and mst.bill_code = #{query.bill_code}
|
||||
</if>
|
||||
</where>
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,240 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.iostorInv.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.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.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
||||
import org.nl.wms.storage_manage.CHANGE_BILL_TYPE_ENUM;
|
||||
import org.nl.wms.storage_manage.IOSEnum;
|
||||
import org.nl.wms.storage_manage.basedata.service.record.dto.StIvtStructivtflowDto;
|
||||
import org.nl.wms.storage_manage.basedata.service.record.service.IStIvtStructivtflowService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvOutYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvdisYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvdtlYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdisYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdtlYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.mapper.StIvtIostorinvYlMapper;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.IStIvtStructivtYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 出入库单主表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-05-10
|
||||
*/
|
||||
@Service
|
||||
public class StIvtIostorinvOutYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMapper, StIvtIostorinvYl> implements IStIvtIostorinvOutYlService {
|
||||
|
||||
@Autowired
|
||||
private IStIvtBsrealstorattrService stIvtBsrealstorattrService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtIostorinvdtlYlService iostorinvdtlYlService;
|
||||
|
||||
@Autowired
|
||||
private StIvtIostorinvYlMapper iostorinvYlMapper;
|
||||
|
||||
@Autowired
|
||||
private IStIvtIostorinvdisYlService iostorinvdisYlService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtflowService structivtflowService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtYlService structivtYlService;
|
||||
|
||||
@Autowired
|
||||
private IPcsIfPurchaseorderService purchaseorderService;
|
||||
|
||||
|
||||
@Override
|
||||
public Object pageQuery(YlIostorInvQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
List<Map> mst_detail = iostorinvYlMapper.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("请求参数不能为空");
|
||||
|
||||
// 调用主表 插入/更新方法
|
||||
StIvtIostorinvYl stIvtIostorinvYl = packageMstForm(new StIvtIostorinvYl(), form, false);
|
||||
// 插入主表
|
||||
this.save(stIvtIostorinvYl);
|
||||
|
||||
// 调用明细表 插入/更新方法
|
||||
iostorinvdtlYlService.create(rows, stIvtIostorinvYl.getIostorinv_id());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateBill(JSONObject form) {
|
||||
Assert.notNull(new Object[]{form, form.get("iostorinv_id")}, "请求参数不能为空");
|
||||
StIvtIostorinvYl mst = form.toJavaObject(StIvtIostorinvYl.class);
|
||||
mst.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
mst.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
mst.setUpdate_time(DateUtil.now());
|
||||
this.updateById(mst);
|
||||
|
||||
JSONArray rows = form.getJSONArray("tableData");
|
||||
if (ObjectUtil.isEmpty(rows)) throw new BadRequestException("请求参数不能为空");
|
||||
// 调用明细表 插入/更新方法
|
||||
iostorinvdtlYlService.create(rows, form.getString("iostorinv_id"));
|
||||
return mst.getIostorinv_id();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long[] ids) {
|
||||
|
||||
for (Long id : ids) {
|
||||
StIvtIostorinvYl dao = this.getOne(new QueryWrapper<StIvtIostorinvYl>().eq("iostorinv_id", id));
|
||||
dao.setIs_delete(true);
|
||||
|
||||
this.updateById(dao);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getInvDtl(JSONObject form) {
|
||||
return iostorinvdtlYlService.getDtlList(form);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
public void confirm(JSONObject form) {
|
||||
Assert.notNull(new Object[]{form, form.get("iostorinv_id")}, "请求参数不能为空");
|
||||
|
||||
String iostorinv_id = form.getString("iostorinv_id");
|
||||
|
||||
StIvtIostorinvYl mst = this.getById(iostorinv_id);
|
||||
|
||||
List<StIvtIostorinvdisYl> dis_list = iostorinvdisYlService.list(new QueryWrapper<StIvtIostorinvdisYl>().eq("iostorinv_id", iostorinv_id));
|
||||
List<StIvtIostorinvdtlYl> dtl_list = iostorinvdtlYlService.list(new QueryWrapper<StIvtIostorinvdtlYl>().eq("iostorinv_id", iostorinv_id));
|
||||
|
||||
if (ObjectUtil.isEmpty(dis_list)) {
|
||||
throw new BadRequestException("该入库单不存在分配明细!");
|
||||
}
|
||||
|
||||
if (mst == null || mst.getIs_delete() == true) {
|
||||
throw new BadRequestException("单据不存在");
|
||||
}
|
||||
|
||||
//修改分配状态
|
||||
dis_list.forEach(dis -> {
|
||||
dis.setReal_qty(dis.getPlan_qty());
|
||||
dis.setWork_status(IOSEnum.WORK_STATUS.code("完成"));
|
||||
iostorinvdisYlService.updateById(dis);
|
||||
|
||||
//修改库存和插入库存变动记录表
|
||||
structivtflowService.recordStructivtFlow(
|
||||
StIvtStructivtflowDto.builder()
|
||||
.bill_code(mst.getBill_code()).change_type_scode(CHANGE_BILL_TYPE_ENUM.IOSTORINV_IN_CONFIRM).bill_table("st_ivt_iostorinv_bcp")
|
||||
.material_id(dis.getMaterial_id()).pcsn(dis.getPcsn())
|
||||
.struct_code(dis.getStruct_code()).result_qty(structivtYlService.getOne(new QueryWrapper<StIvtStructivtYl>().eq("struct_code", dis.getStruct_code())).getCanuse_qty()).change_qty(dis.getReal_qty())
|
||||
.task_id(dis.getTask_id())
|
||||
.storagevehicle_code(dis.getStoragevehicle_code())
|
||||
.build()
|
||||
);
|
||||
});
|
||||
|
||||
//修改明细状态
|
||||
dtl_list.forEach(dtl -> {
|
||||
dtl.setReal_qty(dtl.getPlan_qty());
|
||||
dtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
iostorinvdtlYlService.updateById(dtl);
|
||||
|
||||
//如果单据类型为原料入库
|
||||
if (mst.getBill_type().equals(IOSEnum.BILL_TYPE.code("原料入库"))) {
|
||||
JSONObject pur_jo = new JSONObject();
|
||||
pur_jo.put("po_code", dtl.getSource_bill_code());
|
||||
pur_jo.put("instor_qty", dtl.getReal_qty());
|
||||
purchaseorderService.updatePurchaseNum(pur_jo);
|
||||
}
|
||||
});
|
||||
|
||||
//修改主表
|
||||
mst.setConfirm_id(SecurityUtils.getCurrentUserId());
|
||||
mst.setConfirm_name(SecurityUtils.getCurrentNickName());
|
||||
mst.setConfirm_time(DateUtil.now());
|
||||
mst.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
this.updateById(mst);
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtIostorinvYl packageMstForm(StIvtIostorinvYl stIvtIostorinvYl, JSONObject whereJson, Boolean isUpdate) {
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
if (!isUpdate) {
|
||||
// 新增
|
||||
stIvtIostorinvYl.setIostorinv_id(IdUtil.getStringId());
|
||||
stIvtIostorinvYl.setBill_code(CodeUtil.getNewCode("IO_CODE"));
|
||||
stIvtIostorinvYl.setIo_type(IOSEnum.IO_TYPE.code("入库"));
|
||||
stIvtIostorinvYl.setBuss_type(whereJson.getString("bill_type"));
|
||||
stIvtIostorinvYl.setBill_type(stIvtIostorinvYl.getBuss_type());
|
||||
stIvtIostorinvYl.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
stIvtIostorinvYl.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
stIvtIostorinvYl.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
stIvtIostorinvYl.setCreate_time(DateUtil.now());
|
||||
stIvtIostorinvYl.setIs_delete(false);
|
||||
stIvtIostorinvYl.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
stIvtIostorinvYl.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
stIvtIostorinvYl.setUpdate_time(DateUtil.now());
|
||||
// TODO 暂时写死
|
||||
stIvtIostorinvYl.setSysdeptid("111");
|
||||
stIvtIostorinvYl.setSyscompanyid("111");
|
||||
|
||||
} else {
|
||||
// 修改
|
||||
stIvtIostorinvYl.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
stIvtIostorinvYl.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
stIvtIostorinvYl.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
stIvtIostorinvYl.setBiz_date(whereJson.getString("biz_date").substring(0, 10));
|
||||
// 获取仓库信息
|
||||
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("仓库不存在或未启用!");
|
||||
|
||||
stIvtIostorinvYl.setStor_id(bsrealDao.getStor_id());
|
||||
stIvtIostorinvYl.setStor_code(bsrealDao.getStor_code());
|
||||
stIvtIostorinvYl.setStor_name(bsrealDao.getStor_name());
|
||||
stIvtIostorinvYl.setTotal_qty(whereJson.getBigDecimal("total_qty"));
|
||||
stIvtIostorinvYl.setDetail_count(rows.size());
|
||||
stIvtIostorinvYl.setRemark(whereJson.getString("remark"));
|
||||
|
||||
return stIvtIostorinvYl;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.iostorInv.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -17,17 +18,27 @@ 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.dao.StIvtBsrealstorattr;
|
||||
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
||||
import org.nl.wms.storage_manage.CHANGE_BILL_TYPE_ENUM;
|
||||
import org.nl.wms.storage_manage.IOSEnum;
|
||||
|
||||
import org.nl.wms.storage_manage.basedata.service.record.dto.StIvtStructivtflowDto;
|
||||
import org.nl.wms.storage_manage.basedata.service.record.service.IStIvtStructivtflowService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvdisYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.IStIvtIostorinvdtlYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdisYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.StIvtIostorinvdtlYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dao.mapper.StIvtIostorinvYlMapper;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.IStIvtStructivtYlService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
|
||||
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.StIvtStructivtBcp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -51,6 +62,18 @@ public class StIvtIostorinvYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMap
|
||||
@Autowired
|
||||
private StIvtIostorinvYlMapper iostorinvYlMapper;
|
||||
|
||||
@Autowired
|
||||
private IStIvtIostorinvdisYlService iostorinvdisYlService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtflowService structivtflowService;
|
||||
|
||||
@Autowired
|
||||
private IStIvtStructivtYlService structivtYlService;
|
||||
|
||||
@Autowired
|
||||
private IPcsIfPurchaseorderService purchaseorderService;
|
||||
|
||||
|
||||
@Override
|
||||
public Object pageQuery(YlIostorInvQuery query, PageQuery pageQuery) {
|
||||
@@ -81,7 +104,7 @@ public class StIvtIostorinvYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMap
|
||||
StIvtIostorinvYl mst = form.toJavaObject(StIvtIostorinvYl.class);
|
||||
mst.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
mst.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
mst.setUpdate_time(new Date());
|
||||
mst.setUpdate_time(DateUtil.now());
|
||||
this.updateById(mst);
|
||||
|
||||
JSONArray rows = form.getJSONArray("tableData");
|
||||
@@ -108,7 +131,64 @@ public class StIvtIostorinvYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMap
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackOn = Exception.class)
|
||||
public void confirm(JSONObject form) {
|
||||
Assert.notNull(new Object[]{form, form.get("iostorinv_id")}, "请求参数不能为空");
|
||||
|
||||
String iostorinv_id = form.getString("iostorinv_id");
|
||||
|
||||
StIvtIostorinvYl mst = this.getById(iostorinv_id);
|
||||
|
||||
List<StIvtIostorinvdisYl> dis_list = iostorinvdisYlService.list(new QueryWrapper<StIvtIostorinvdisYl>().eq("iostorinv_id", iostorinv_id));
|
||||
List<StIvtIostorinvdtlYl> dtl_list = iostorinvdtlYlService.list(new QueryWrapper<StIvtIostorinvdtlYl>().eq("iostorinv_id", iostorinv_id));
|
||||
|
||||
if (ObjectUtil.isEmpty(dis_list)) {
|
||||
throw new BadRequestException("该入库单不存在分配明细!");
|
||||
}
|
||||
|
||||
if (mst == null || mst.getIs_delete() == true) {
|
||||
throw new BadRequestException("单据不存在");
|
||||
}
|
||||
|
||||
//修改分配状态
|
||||
dis_list.forEach(dis -> {
|
||||
dis.setReal_qty(dis.getPlan_qty());
|
||||
dis.setWork_status(IOSEnum.WORK_STATUS.code("完成"));
|
||||
iostorinvdisYlService.updateById(dis);
|
||||
|
||||
//修改库存和插入库存变动记录表
|
||||
structivtflowService.recordStructivtFlow(
|
||||
StIvtStructivtflowDto.builder()
|
||||
.bill_code(mst.getBill_code()).change_type_scode(CHANGE_BILL_TYPE_ENUM.IOSTORINV_IN_CONFIRM).bill_table("st_ivt_iostorinv_bcp")
|
||||
.material_id(dis.getMaterial_id()).pcsn(dis.getPcsn())
|
||||
.struct_code(dis.getStruct_code()).result_qty(structivtYlService.getOne(new QueryWrapper<StIvtStructivtYl>().eq("struct_code", dis.getStruct_code())).getCanuse_qty()).change_qty(dis.getReal_qty())
|
||||
.task_id(dis.getTask_id())
|
||||
.storagevehicle_code(dis.getStoragevehicle_code())
|
||||
.build()
|
||||
);
|
||||
});
|
||||
|
||||
//修改明细状态
|
||||
dtl_list.forEach(dtl -> {
|
||||
dtl.setReal_qty(dtl.getPlan_qty());
|
||||
dtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
iostorinvdtlYlService.updateById(dtl);
|
||||
|
||||
//如果单据类型为原料入库
|
||||
if (mst.getBill_type().equals(IOSEnum.BILL_TYPE.code("原料入库"))) {
|
||||
JSONObject pur_jo = new JSONObject();
|
||||
pur_jo.put("po_code", dtl.getSource_bill_code());
|
||||
pur_jo.put("instor_qty", dtl.getReal_qty());
|
||||
purchaseorderService.updatePurchaseNum(pur_jo);
|
||||
}
|
||||
});
|
||||
|
||||
//修改主表
|
||||
mst.setConfirm_id(SecurityUtils.getCurrentUserId());
|
||||
mst.setConfirm_name(SecurityUtils.getCurrentNickName());
|
||||
mst.setConfirm_time(DateUtil.now());
|
||||
mst.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
|
||||
this.updateById(mst);
|
||||
|
||||
}
|
||||
|
||||
@@ -125,20 +205,20 @@ public class StIvtIostorinvYlServiceImpl extends ServiceImpl<StIvtIostorinvYlMap
|
||||
stIvtIostorinvYl.setBill_status(IOSEnum.BILL_STATUS.code("生成"));
|
||||
stIvtIostorinvYl.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
stIvtIostorinvYl.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
stIvtIostorinvYl.setCreate_time(new Date());
|
||||
stIvtIostorinvYl.setCreate_time(DateUtil.now());
|
||||
stIvtIostorinvYl.setIs_delete(false);
|
||||
stIvtIostorinvYl.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
stIvtIostorinvYl.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
stIvtIostorinvYl.setUpdate_time(new Date());
|
||||
stIvtIostorinvYl.setUpdate_time(DateUtil.now());
|
||||
// TODO 暂时写死
|
||||
stIvtIostorinvYl.setSysdeptid("111");
|
||||
stIvtIostorinvYl.setSyscompanyid("111");
|
||||
|
||||
|
||||
} else {
|
||||
// 修改
|
||||
stIvtIostorinvYl.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
stIvtIostorinvYl.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
stIvtIostorinvYl.setUpdate_time(new Date());
|
||||
stIvtIostorinvYl.setUpdate_time(DateUtil.now());
|
||||
}
|
||||
|
||||
stIvtIostorinvYl.setBiz_date(whereJson.getString("biz_date").substring(0, 10));
|
||||
|
||||
@@ -41,7 +41,7 @@ public class StIvtIostorinvdisYlServiceImpl extends ServiceImpl<StIvtIostorinvdi
|
||||
@Override
|
||||
public void create(JSONObject jo, JSONObject mst_jo) {
|
||||
if (ObjectUtil.isNotEmpty(mst_jo)) {
|
||||
// 先删除在插入
|
||||
|
||||
String mst_id = mst_jo.getString("mst_id");
|
||||
String dtl_id = mst_jo.getString("dtl_id");
|
||||
String iostorinvdisYl_id = IdUtil.getStringId();
|
||||
@@ -56,24 +56,6 @@ public class StIvtIostorinvdisYlServiceImpl extends ServiceImpl<StIvtIostorinvdi
|
||||
row.setWork_status(IOSEnum.WORK_STATUS.code("未生成"));
|
||||
row.setPlan_qty(row.getPlan_qty());
|
||||
|
||||
// 获取库区信息
|
||||
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_code(sectDao.getSect_code());
|
||||
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_code(structDao.getStruct_code());
|
||||
row.setStruct_name(structDao.getStruct_name());
|
||||
row.setPcsn(DateUtil.today());
|
||||
this.save(row);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.structIvt;
|
||||
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dto.StructIvtYLQuery;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +16,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
*/
|
||||
public interface IStIvtStructivtYlService extends IService<StIvtStructivtYl> {
|
||||
|
||||
/**
|
||||
* 分页查询可用的原料库存
|
||||
*
|
||||
* @param query,page /
|
||||
* @return JSONObject
|
||||
*/
|
||||
Object getRawIvt(StructIvtYLQuery query, PageQuery page);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dto.StructIvtYLQuery;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -13,4 +20,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
public interface StIvtStructivtYlMapper extends BaseMapper<StIvtStructivtYl> {
|
||||
|
||||
List<Map> getRawIvt(@Param("query") StructIvtYLQuery query, @Param("pageQuery") PageQuery pageQuery);
|
||||
}
|
||||
|
||||
@@ -2,4 +2,37 @@
|
||||
<!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.rawmanage.service.structIvt.dao.mapper.StIvtStructivtYlMapper">
|
||||
|
||||
<select id="getRawIvt" resultType="java.util.Map">
|
||||
SELECT
|
||||
ivt.*,
|
||||
mu.unit_name AS qty_unit_name,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
sa.sect_id,
|
||||
sa.sect_code,
|
||||
sa.sect_name,
|
||||
sa.struct_id,
|
||||
sa.struct_code,
|
||||
sa.struct_name,
|
||||
class.class_name
|
||||
FROM
|
||||
st_ivt_structivt_yl ivt
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id
|
||||
LEFT JOIN st_ivt_structattr sa ON sa.struct_id = ivt.struct_id
|
||||
LEFT JOIN md_pb_measureunit mu ON mu.measure_unit_id = ivt.qty_unit_id
|
||||
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||
<where>
|
||||
ivt.canuse_qty > 0
|
||||
|
||||
<if test="query.material_search != null and query.material_search != ''">
|
||||
and (mb.material_code = #{query.material_search} OR mb.material_name = #{query.material_search})
|
||||
</if>
|
||||
<if test="query.sect_id != null and query.sect_id != ''">
|
||||
and sa.sect_id = #{query.sect_id}
|
||||
</if>
|
||||
<if test="query.struct_id != null and query.struct_id != ''">
|
||||
and sa.struct_id = #{query.struct_id}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.structIvt.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.rawmanage.service.structIvt.dao.StIvtStructivtYl;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/5/4 19:49
|
||||
*/
|
||||
@Data
|
||||
public class StructIvtYLQuery extends BaseQuery<StIvtStructivtYl> {
|
||||
|
||||
|
||||
private String sect_id;
|
||||
|
||||
private String struct_id;
|
||||
|
||||
private String material_search;
|
||||
|
||||
private Boolean is_delete = false;
|
||||
|
||||
|
||||
@Override
|
||||
public void paramMapping() {
|
||||
super.doP.put("material_search", QParam.builder().k(new String[]{"material_search"}).type(QueryTEnum.LK).build());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.structIvt.impl;
|
||||
|
||||
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.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.StIvtStructivtYl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.mapper.StIvtStructivtYlMapper;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.IStIvtStructivtYlService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dto.StructIvtYLQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 仓位库存表 服务实现类
|
||||
@@ -17,4 +27,14 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class StIvtStructivtYlServiceImpl extends ServiceImpl<StIvtStructivtYlMapper, StIvtStructivtYl> implements IStIvtStructivtYlService {
|
||||
|
||||
@Autowired
|
||||
private StIvtStructivtYlMapper structivtYlMapper;
|
||||
@Override
|
||||
public Object getRawIvt(StructIvtYLQuery query, PageQuery pageQuery) {
|
||||
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||
List<Map> mst_detail = structivtYlMapper.getRawIvt(query, pageQuery);
|
||||
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||
build.setTotalElements(page.getTotal());
|
||||
return build;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user