add:增加需求单功能;

opt:优化组盘表,根据物料编码存储
This commit is contained in:
zhangzq
2026-06-04 10:02:18 +08:00
parent 31d492750d
commit 4d75b90506
55 changed files with 1407 additions and 218 deletions

View File

@@ -59,7 +59,11 @@
<artifactId>jna-platform</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<!-- 图片缩略图 -->
<dependency>
<groupId>net.coobird</groupId>

View File

@@ -24,10 +24,10 @@
FROM
st_ivt_structattr
LEFT JOIN md_pb_groupplate ON st_ivt_structattr.storagevehicle_code = md_pb_groupplate.storagevehicle_code
LEFT JOIN md_me_materialbase ON md_me_materialbase.material_id = md_pb_groupplate.material_id
LEFT JOIN md_me_materialbase ON md_me_materialbase.material_id = md_pb_groupplate.material_code
WHERE
st_ivt_structattr.storagevehicle_code IS NOT NULL
and md_pb_groupplate.material_id is not null
and md_pb_groupplate.material_code is not null
and stor_code = #{storCode}
GROUP BY
stor_code,material_id

View File

@@ -415,7 +415,7 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
record.setId(IdUtil.getStringId());
record.setUpdate_time(now);
record.setVehicle_code(vehicleCode);
record.setMaterial_id(vehicleMater.getMaterial_id());
record.setMaterial_id(vehicleMater.getMaterial_code());
record.setPcsn(vehicleMater.getPcsn());
record.setQty(vehicleMater.getQty());
record.setChange_qty(vehicleMater.getFrozen_qty());

View File

@@ -0,0 +1,41 @@
package org.nl.wms.ext_manage.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* MES需求单同步接口
*/
@Slf4j
@RestController
@RequestMapping("api/mes/demand")
@RequiredArgsConstructor
public class MesDemandController {
@Autowired
private IPmDemandService iPmDemandService;
/**
* MES下发需求单接口
* @param param 需求单参数(支持单个对象或数组)
* @return 响应结果
*/
@PostMapping("/mesRequisitionSync")
@SaIgnore
public ResponseEntity<Object> confirm(@RequestBody List<PmDemandParam> params) {
iPmDemandService.batchCreate(params);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -21,4 +21,9 @@ public class EXTConstant {
* ACS下发任务接口地址
*/
public final static String SEND_TASK_ACS_API = "api/wms/task";
/**
* 中鼎查询库存接口地址
*/
public final static String QUERY_INVENTORY_ZD_API = "/app/restful/api/v3/wms/getInventoryList";
}

View File

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import org.nl.wms.ext_manage.service.dto.ZDInventory;
import org.springframework.http.ResponseEntity;
import java.util.List;
/**
* <p>
* WMS调用中鼎服务类
@@ -33,5 +35,5 @@ public interface WmsToZDWmdService {
/**
*
*/
ResponseEntity<ZDInventory> queryInventory(String materialCode);
ResponseEntity<List<ZDInventory>> queryInventory(String materialCode);
}

View File

@@ -1,23 +1,15 @@
package org.nl.wms.ext_manage.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
public class ZDInventory {
private String id;
/**
* 物料编码
*/
private String materialCode;
/**
* 物料名称
*/
private String materialName;
/**
* 物料总数量
*/
private String totalQty;
/**
* 所属仓库
*/
private String storCode;
private String houseCode;
private String skuCode;
private String batchNo;
private BigDecimal qty;
}

View File

@@ -0,0 +1,94 @@
package org.nl.wms.ext_manage.service.impl;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.exception.BadRequestException;
import org.nl.config.SpringContextHolder;
import org.nl.wms.ext_manage.enums.EXTConstant;
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
import org.nl.wms.ext_manage.service.dto.ZDInventory;
import org.nl.wms.system_manage.enums.SysParamConstant;
import org.nl.wms.system_manage.service.param.dao.Param;
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
@Override
public ResponseEntity syncDemandOrder(JSONObject whereJson) {
log.info("syncDemandOrder生产领料需求单下发输入参数-------------------" + whereJson.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL).getValue();
// TODO: add demand order API path to EXTConstant once endpoint is confirmed
try {
String resultMsg = HttpRequest.post(url)
.body(whereJson.toString())
.execute().body();
JSONObject result = JSONObject.parseObject(resultMsg);
log.info("syncDemandOrder需求单下发输出参数-------------------" + result.toString());
return new ResponseEntity<>(result, HttpStatus.OK);
} catch (Exception e) {
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
}
}
@Override
public ResponseEntity syncPurchaseReceiving(JSONObject whereJson) {
log.info("syncPurchaseReceiving采购入库单下发输入参数-------------------" + whereJson.toString());
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL).getValue();
// TODO: add purchase receiving API path to EXTConstant once endpoint is confirmed
try {
String resultMsg = HttpRequest.post(url)
.body(whereJson.toString())
.execute().body();
JSONObject result = JSONObject.parseObject(resultMsg);
log.info("syncPurchaseReceiving采购入库单下发输出参数-------------------" + result.toString());
return new ResponseEntity<>(result, HttpStatus.OK);
} catch (Exception e) {
throw new BadRequestException("中鼎采购入库单下发失败:" + e.getMessage());
}
}
@Override
public ResponseEntity<List<ZDInventory>> queryInventory(String skuCode) {
log.info("queryInventory查询SKU库存输入参数skuCode={}", skuCode);
Param param = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL);
if (param==null){
throw new BadRequestException("查询中鼎库存失败,接口地址未配置");
}
String baseUrl = param.getValue();
String url = baseUrl + EXTConstant.QUERY_INVENTORY_ZD_API;
JSONObject requestBody = new JSONObject();
requestBody.put("SkuCode", skuCode);
requestBody.put("HouseCode", "");
requestBody.put("HouseCodeLis", new JSONArray());
try {
String resultMsg = HttpRequest.post(url)
.contentType("application/json")
.body(requestBody.toString())
.execute().body();
log.info("queryInventory查询SKU库存输出参数-------------------" + resultMsg);
JSONObject result = JSONObject.parseObject(resultMsg);
Integer respCode = result.getInteger("respCode");
if (respCode == null || respCode != 0) {
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
}
List<ZDInventory> inventorys = result.getJSONArray("data").toJavaList(ZDInventory.class);
return new ResponseEntity<>(inventorys, HttpStatus.OK);
} catch (BadRequestException e) {
throw e;
} catch (Exception e) {
throw new BadRequestException("中鼎库存查询异常:" + e.getMessage());
}
}
}

View File

@@ -172,7 +172,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
}
GroupPlate groupDao = GroupPlate.builder()
.group_id(IdUtil.getStringId())
.material_id(materDao.getMaterial_code())
.material_code(materDao.getMaterial_code())
.storagevehicle_code(vehicleDao.getStoragevehicle_code())
.pcsn(pcsn)
.qty_unit_id(unitDao.getMeasure_unit_id())
@@ -449,7 +449,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
ArrayList<HashMap> tableData = new ArrayList<>();
HashMap<String, String> dtl = new HashMap<>();
GroupPlate plateDao = plateDaoList.get(0);
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(plateDao.getMaterial_id());
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(plateDao.getMaterial_code());
dtl.put("storagevehicle_code", plateDao.getStoragevehicle_code());
dtl.put("material_id", materDao.getMaterial_id());
dtl.put("material_code", materDao.getMaterial_code());

View File

@@ -192,7 +192,7 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
.eq(GroupPlate::getGroup_id, whereJson.getString("group_id")));
Structattr sectDao = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
.eq(Structattr::getStruct_code, whereJson.getString("struct_code")));
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_id());
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getById(plateDao.getMaterial_code());
whereJson.put("material_id", materDao.getMaterial_id());
whereJson.put("material_code", materDao.getMaterial_code());
whereJson.put("store_id", sectDao.getStor_id());

View File

@@ -0,0 +1,79 @@
package org.nl.wms.pm_manage.demand.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import org.nl.common.base.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.logging.annotation.Log;
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
import org.nl.wms.pm_manage.demand.service.dto.DemandInventryDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Arrays;
import java.util.List;
@RestController
@RequestMapping("/api/pmDemand")
@SaIgnore
public class PmDemandController {
@Resource
private IPmDemandService pmDemandService;
@GetMapping
@Log("查询需求单")
public ResponseEntity<Object> queryAll(PmDemandQuery query, PageQuery page) {
return new ResponseEntity<>(TableDataInfo.build(pmDemandService.queryPage(query, page)), HttpStatus.OK);
}
@PostMapping
@Log("新增需求单")
public ResponseEntity<Object> create(@Valid @RequestBody PmDemandParam param) {
pmDemandService.create(param);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping
@Log("修改需求单")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Object> update(@Valid @RequestBody PmDemandParam param) {
pmDemandService.update(param);
return new ResponseEntity<>(HttpStatus.OK);
}
@DeleteMapping
@Log("删除需求单")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
List<String> idList = Arrays.asList(ids);
pmDemandService.deleteByIds(idList);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/queryInventory")
@Log("根据需求单查询所有库存信息")
public ResponseEntity<List<DemandInventryDto>> queryInventory(String skuCode) {
return new ResponseEntity<>(pmDemandService.queryInventory(skuCode), HttpStatus.OK);
}
@PostMapping("/allocate")
@Log("库存分配")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Object> allocateInventory(@RequestBody PmDemandDto demand) {
pmDemandService.allocateInventory(demand.getId(), demand.getInventoryDis());
return new ResponseEntity<>(HttpStatus.OK);
}
@PostMapping("/push")
@Log("需求单下发")
@Transactional(rollbackFor = Exception.class)
public ResponseEntity<Object> push(@RequestBody PmDemandDto pmDemandDto) {
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,48 @@
package org.nl.wms.pm_manage.demand.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
import org.nl.wms.pm_manage.demand.service.dto.DemandInventryDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
import java.util.List;
public interface IPmDemandService extends IService<PmDemand> {
Page<PmDemandDto> queryPage(PmDemandQuery query, PageQuery pageQuery);
void create(PmDemandParam param);
void batchCreate(List<PmDemandParam> param);
void update(PmDemandParam param);
void deleteByIds(List<String> ids);
/**
* 根据需求单查询库存信息
* @param skuCode
* @return
*/
List<DemandInventryDto> queryInventory(String skuCode);
/**
* 库存分配
* @param id
* @param inventoryDis
*/
void allocateInventory(String id, String inventoryDis);
/**
* 推送需求单
* 1.需求单分配出库仓库
* 2。如果分配给中鼎则直接将需求单推送给中鼎WMS如果有这边出库则在WMS上生成出库单有操作人点击自动分配分配库存
* 3。一个物料可能存在多个仓库如果是平库则不生成AGV任务如果是高架库则分配完自动生成AGV任务
* 4。当前
* @param pmDemandDto
*/
void pushDemand(PmDemandDto pmDemandDto);
}

View File

@@ -0,0 +1,66 @@
package org.nl.wms.pm_manage.demand.service.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("pm_demand")
public class PmDemand extends Model<PmDemand> {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.INPUT)
private String id;
private String creator;
@TableField("create_time")
private String create_time;
private Integer priority;
private Integer status;
@TableField("work_order")
private String work_order;
@TableField("sku_code")
private String sku_code;
@TableField("sku_name")
private String sku_name;
private BigDecimal qty;
private String unit;
@TableField("target_area")
private String target_area;
@TableField("production_line")
private String production_line;
private String sn;
@TableField("create_at")
private String create_at;
@TableField("inventory_dis")
private String inventory_dis;
@Override
protected Serializable pkVal() {
return this.id;
}
}

View File

@@ -0,0 +1,14 @@
package org.nl.wms.pm_manage.demand.service.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
import java.util.List;
public interface PmDemandMapper extends BaseMapper<PmDemand> {
List<PmDemandDto> queryPage(@Param("query") PmDemandQuery query);
}

View File

@@ -0,0 +1,57 @@
<?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.pm_manage.demand.service.dao.mapper.PmDemandMapper">
<resultMap id="DemandDtoMap" type="org.nl.wms.pm_manage.demand.service.dto.PmDemandDto">
<result property="id" column="id"/>
<result property="creator" column="creator"/>
<result property="createTime" column="create_time"/>
<result property="priority" column="priority"/>
<result property="status" column="status"/>
<result property="workOrder" column="work_order"/>
<result property="skuCode" column="sku_code"/>
<result property="skuName" column="sku_name"/>
<result property="qty" column="qty"/>
<result property="unit" column="unit"/>
<result property="targetArea" column="target_area"/>
<result property="productionLine" column="production_line"/>
<result property="sn" column="sn"/>
<result property="createAt" column="create_at"/>
<result property="inventoryDis" column="inventory_dis"/>
</resultMap>
<select id="queryPage" resultMap="DemandDtoMap">
select *
from pm_demand
<where>
<if test="query.id != null and query.id != ''">
and id = #{query.id}
</if>
<if test="query.creator != null and query.creator != ''">
and creator like concat('%', #{query.creator}, '%')
</if>
<if test="query.status != null">
and status = #{query.status}
</if>
<if test="query.workOrder != null and query.workOrder != ''">
and work_order like concat('%', #{query.workOrder}, '%')
</if>
<if test="query.skuCode != null and query.skuCode != ''">
and (sku_code like concat('%', #{query.skuCode}, '%') or sku_name like concat('%', #{query.skuCode}, '%'))
</if>
<if test="query.productionLine != null and query.productionLine != ''">
and production_line like concat('%', #{query.productionLine}, '%')
</if>
<if test="query.targetArea != null and query.targetArea != ''">
and target_area like concat('%', #{query.targetArea}, '%')
</if>
<if test="query.startTime != null and query.startTime != ''">
and create_time &gt;= #{query.startTime}
</if>
<if test="query.endTime != null and query.endTime != ''">
and create_time &lt;= #{query.endTime}
</if>
</where>
order by priority desc, create_time desc
</select>
</mapper>

View File

@@ -0,0 +1,14 @@
package org.nl.wms.pm_manage.demand.service.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class DemandInventryDto {
private String skuCode;
private String skuName;
private BigDecimal qty;
private String houseCode;
private String houseName;
}

View File

@@ -0,0 +1,26 @@
package org.nl.wms.pm_manage.demand.service.dto;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class PmDemandDto {
private String id;
private String creator;
private String createTime;
private Integer priority;
private Integer status;
private String workOrder;
private String skuCode;
private String skuName;
private BigDecimal qty;
private String unit;
private String targetArea;
private String productionLine;
private String sn;
private String createAt;
private String inventoryDis;
}

View File

@@ -0,0 +1,84 @@
package org.nl.wms.pm_manage.demand.service.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.Data;
import org.nl.common.domain.handler.IsoToLocalDateTimeStringDeserializer;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* MES需求单接口参数
* 数据库字段:下划线命名
* JSON字段大写驼峰命名
*/
@Data
public class PmDemandParam {
@NotBlank(message = "单据唯一ID不能为空")
@JsonProperty("Id")
private String id;
@NotBlank(message = "操作人不能为空")
@JsonProperty("Creator")
private String creator;
@NotBlank(message = "需求日期不能为空")
@JsonProperty("CreateTime")
private String createTime;
@NotNull(message = "优先级不能为空")
@JsonProperty("Priority")
private Integer priority;
@JsonProperty("Status")
private Integer status;
@NotBlank(message = "工单编号不能为空")
@JsonProperty("WorkOrder")
private String workOrder;
@NotBlank(message = "物料编码不能为空")
@JsonProperty("SkuCode")
private String skuCode;
@NotBlank(message = "物料名称不能为空")
@JsonProperty("SkuName")
private String skuName;
@NotNull(message = "数量不能为空")
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
@JsonProperty("Qty")
private BigDecimal qty;
@NotBlank(message = "单位不能为空")
@JsonProperty("Unit")
private String unit;
@NotBlank(message = "目标库存地点不能为空")
@JsonProperty("TargetArea")
private String targetArea;
@NotBlank(message = "产线不能为空")
@JsonProperty("ProductionLine")
private String productionLine;
@JsonProperty("SN")
private String sn;
@JsonProperty("MaxLoad")
private String maxLoad;
@NotBlank(message = "目标仓别不能为空")
@JsonProperty("TargetHouseCode")
private String targetHouseCode;
@JsonProperty("BatchNo")
private String batchNo;
@JsonProperty("Remark")
private String remark;
}

View File

@@ -0,0 +1,19 @@
package org.nl.wms.pm_manage.demand.service.dto;
import lombok.Data;
import org.nl.common.domain.query.BaseQuery;
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
@Data
public class PmDemandQuery extends BaseQuery<PmDemand> {
private String id;
private String creator;
private Integer status;
private String workOrder;
private String skuCode;
private String productionLine;
private String targetArea;
private String startTime;
private String endTime;
}

View File

@@ -0,0 +1,158 @@
package org.nl.wms.pm_manage.demand.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.exception.BadRequestException;
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
import org.nl.wms.ext_manage.service.dto.ZDInventory;
import org.nl.wms.pm_manage.demand.service.IPmDemandService;
import org.nl.wms.pm_manage.demand.service.dao.PmDemand;
import org.nl.wms.pm_manage.demand.service.dao.mapper.PmDemandMapper;
import org.nl.wms.pm_manage.demand.service.dto.DemandInventryDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import static org.nl.common.domain.query.PageQuery.trimStringFields;
@Service
@Slf4j
public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> implements IPmDemandService {
@Autowired
private IStInventoryService iStInventoryService;
@Autowired
private WmsToZDWmdService wmsToZDWmdService;
@Override
public Page<PmDemandDto> queryPage(PmDemandQuery query, PageQuery pageQuery) {
trimStringFields(query);
com.github.pagehelper.Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
page.setOrderBy("priority desc, create_time desc");
List<PmDemandDto> records = this.baseMapper.queryPage(query);
Page<PmDemandDto> dtoPage = new Page<>(page.getPageNum(), page.getPageSize(), page.getTotal());
dtoPage.setRecords(records);
return dtoPage;
}
@Override
public void create(PmDemandParam param) {
PmDemand demand = new PmDemand();
demand.setId(param.getId());
demand.setCreator(param.getCreator());
demand.setCreate_time(param.getCreateTime());
demand.setPriority(param.getPriority());
demand.setStatus(param.getStatus());
demand.setWork_order(param.getWorkOrder());
demand.setSku_code(param.getSkuCode());
demand.setSku_name(param.getSkuName());
demand.setQty(param.getQty());
demand.setUnit(param.getUnit());
demand.setTarget_area(param.getTargetArea());
demand.setProduction_line(param.getProductionLine());
demand.setSn(param.getSn());
demand.setCreate_at(DateUtil.now());
this.save(demand);
}
@Override
public void batchCreate(List<PmDemandParam> param) {
for (PmDemandParam pmDemandParam : param) {
this.create(pmDemandParam);
}
}
@Override
public void update(PmDemandParam param) {
PmDemand dbDemand = this.getById(param.getId());
if (dbDemand == null) {
throw new BadRequestException("需求单不存在");
}
PmDemand demand = new PmDemand();
demand.setId(param.getId());
demand.setCreator(param.getCreator());
demand.setCreate_time(param.getCreateTime());
demand.setPriority(param.getPriority());
demand.setStatus(param.getStatus());
demand.setWork_order(param.getWorkOrder());
demand.setSku_code(param.getSkuCode());
demand.setSku_name(param.getSkuName());
demand.setQty(param.getQty());
demand.setUnit(param.getUnit());
demand.setTarget_area(param.getTargetArea());
demand.setProduction_line(param.getProductionLine());
demand.setSn(param.getSn());
demand.setCreate_at(dbDemand.getCreate_at());
this.updateById(demand);
}
@Override
public void deleteByIds(List<String> ids) {
if (CollectionUtils.isEmpty(ids)) {
return;
}
this.removeByIds(ids);
}
@Override
public void allocateInventory(String id, String inventoryDis) {
PmDemand demand = this.getById(id);
if (demand == null) {
throw new BadRequestException("需求单不存在");
}
demand.setInventory_dis(inventoryDis);
demand.setStatus(1);
this.updateById(demand);
}
@Override
public List<DemandInventryDto> queryInventory(String skuCode) {
List<DemandInventryDto> resultList = new ArrayList<>();
List<StInventoryDto> inventoryDtos = iStInventoryService.queryInventory(StInventoryQuery.builder().materialCode(skuCode).build());
if (!CollectionUtils.isEmpty(inventoryDtos)) {
for (StInventoryDto dto : inventoryDtos) {
DemandInventryDto demandDto = new DemandInventryDto();
demandDto.setSkuCode(dto.getMaterialCode());
demandDto.setSkuName(dto.getMaterialName());
demandDto.setQty(dto.getQty());
demandDto.setHouseCode(dto.getStructCode());
demandDto.setHouseName(dto.getStorName());
resultList.add(demandDto);
}
}
ResponseEntity<List<ZDInventory>> responseEntity = wmsToZDWmdService.queryInventory(skuCode);
List<ZDInventory> zdInventorys = responseEntity.getBody();
if (!CollectionUtils.isEmpty(zdInventorys)) {
for (ZDInventory item : zdInventorys) {
DemandInventryDto demandDto = new DemandInventryDto();
demandDto.setSkuCode(item.getSkuCode());
demandDto.setSkuName(null);
demandDto.setQty(item.getQty());
demandDto.setHouseCode(item.getHouseCode());
demandDto.setHouseName(null);
resultList.add(demandDto);
}
}
return resultList;
}
@Override
public void pushDemand(PmDemandDto pmDemandDto) {
}
}

View File

@@ -1,4 +1,4 @@
package org.nl.wms.pm_manage.controller;
package org.nl.wms.pm_manage.form.controller;
import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.date.DateUtil;
@@ -9,10 +9,10 @@ import org.apache.commons.lang3.ObjectUtils;
import org.nl.common.base.TableDataInfo;
import org.nl.common.domain.query.PageQuery;
import org.nl.common.logging.annotation.Log;
import org.nl.wms.pm_manage.service.IPmFormDataService;
import org.nl.wms.pm_manage.service.dao.PmFormData;
import org.nl.wms.pm_manage.service.dto.PmFormDataParam;
import org.nl.wms.pm_manage.service.dto.FormDataQuery;
import org.nl.wms.pm_manage.form.service.IPmFormDataService;
import org.nl.wms.pm_manage.form.service.dao.PmFormData;
import org.nl.wms.pm_manage.form.service.dto.PmFormDataParam;
import org.nl.wms.pm_manage.form.service.dto.FormDataQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@@ -1,13 +1,13 @@
package org.nl.wms.pm_manage.service;
package org.nl.wms.pm_manage.form.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.nl.common.domain.query.PageQuery;
import org.nl.wms.pm_manage.service.dao.PmFormData;
import org.nl.wms.pm_manage.service.dto.PmFormDataDto;
import org.nl.wms.pm_manage.service.dto.PmFormDataParam;
import org.nl.wms.pm_manage.service.dto.FormDataQuery;
import org.nl.wms.pm_manage.form.service.dao.PmFormData;
import org.nl.wms.pm_manage.form.service.dto.PmFormDataDto;
import org.nl.wms.pm_manage.form.service.dto.PmFormDataParam;
import org.nl.wms.pm_manage.form.service.dto.FormDataQuery;
import java.util.List;

View File

@@ -1,4 +1,4 @@
package org.nl.wms.pm_manage.service.dao;
package org.nl.wms.pm_manage.form.service.dao;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;

View File

@@ -1,11 +1,11 @@
package org.nl.wms.pm_manage.service.dao.mapper;
package org.nl.wms.pm_manage.form.service.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.nl.wms.pm_manage.service.dao.PmFormData;
import org.nl.wms.pm_manage.service.dto.FormDataQuery;
import org.nl.wms.pm_manage.service.dto.PmFormDataDto;
import org.nl.wms.pm_manage.form.service.dao.PmFormData;
import org.nl.wms.pm_manage.form.service.dto.FormDataQuery;
import org.nl.wms.pm_manage.form.service.dto.PmFormDataDto;
import java.math.BigDecimal;
import java.util.List;

View File

@@ -1,8 +1,8 @@
<?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.pm_manage.service.dao.mapper.PmFormDataMapper">
<mapper namespace="org.nl.wms.pm_manage.form.service.dao.mapper.PmFormDataMapper">
<resultMap id="BaseResultMap" type="org.nl.wms.pm_manage.service.dao.PmFormData">
<resultMap id="BaseResultMap" type="org.nl.wms.pm_manage.form.service.dao.PmFormData">
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="status" column="status"/>
@@ -29,7 +29,7 @@
<result property="remark" column="remark"/>
<result property="is_finish" column="is_finish"/>
</resultMap>
<resultMap id="dataDetail" type="org.nl.wms.pm_manage.service.dto.PmFormDataDto" >
<resultMap id="dataDetail" type="org.nl.wms.pm_manage.form.service.dto.PmFormDataDto" >
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="proc_inst_id" column="proc_inst_id"/>

View File

@@ -1,10 +1,10 @@
package org.nl.wms.pm_manage.service.dto;
package org.nl.wms.pm_manage.form.service.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.pm_manage.service.dao.PmFormData;
import org.nl.wms.pm_manage.form.service.dao.PmFormData;
import java.util.Map;

View File

@@ -1,6 +1,5 @@
package org.nl.wms.pm_manage.service.dto;
package org.nl.wms.pm_manage.form.service.dto;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import java.io.Serializable;

View File

@@ -1,11 +1,11 @@
package org.nl.wms.pm_manage.service.dto;
package org.nl.wms.pm_manage.form.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import lombok.*;
import org.nl.common.domain.handler.IsoToLocalDateTimeStringDeserializer;
import org.nl.common.domain.query.BaseQuery;
import org.nl.wms.pm_manage.service.dao.PmFormData;
import org.nl.wms.pm_manage.form.service.dao.PmFormData;
import java.math.BigDecimal;

View File

@@ -1,4 +1,4 @@
package org.nl.wms.pm_manage.service.impl;
package org.nl.wms.pm_manage.form.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
@@ -20,15 +20,15 @@ import org.nl.wms.basedata_manage.service.IBsrealStorattrService;
import org.nl.wms.basedata_manage.service.IMdPbMeasureunitService;
import org.nl.wms.basedata_manage.service.dao.BsrealStorattr;
import org.nl.wms.basedata_manage.service.dao.MdPbMeasureunit;
import org.nl.wms.pm_manage.service.dao.PmFormData;
import org.nl.wms.pm_manage.service.dao.mapper.PmFormDataMapper;
import org.nl.wms.pm_manage.service.dto.FormDataQuery;
import org.nl.wms.pm_manage.service.dto.PmFormDataDto;
import org.nl.wms.pm_manage.service.dto.PmFormDataParam;
import org.nl.wms.pm_manage.form.service.dao.PmFormData;
import org.nl.wms.pm_manage.form.service.dao.mapper.PmFormDataMapper;
import org.nl.wms.pm_manage.form.service.dto.FormDataQuery;
import org.nl.wms.pm_manage.form.service.dto.PmFormDataDto;
import org.nl.wms.pm_manage.form.service.dto.PmFormDataParam;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import org.nl.wms.pm_manage.service.IPmFormDataService;
import org.nl.wms.pm_manage.form.service.IPmFormDataService;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;

View File

@@ -20,7 +20,6 @@ import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@@ -132,7 +131,7 @@ public class ForewarningTask {
// 计算安全库存数量
BigDecimal totalQty = mdPbStoragevehicleextDtoStructs.stream()
.filter(a -> config.getStor_code().equals(a.getStor_code())
&& material.getMaterial_id().equals(a.getMaterial_id()))
&& material.getMaterial_id().equals(a.getMaterial_code()))
.map(MdPbStoragevehicleextDto::getQty)
.reduce(BigDecimal.ZERO, BigDecimal::add);
@@ -141,7 +140,7 @@ public class ForewarningTask {
try {
earliestPlate = mdPbStoragevehicleextDtoStructs.stream()
.filter(a -> config.getStor_code().equals(a.getStor_code())
&& material.getMaterial_id().equals(a.getMaterial_id()))
&& material.getMaterial_id().equals(a.getMaterial_code()))
.map(a -> {
try {
String createTimeStr = a.getCreate_time();

View File

@@ -22,4 +22,9 @@ public class SysParamConstant {
*/
public final static String ERP_URL = "erp_url";
/**
* 中鼎系统URL
*/
public final static String ZD_URL = "zd_url";
}

View File

@@ -53,8 +53,6 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.function.Predicate;
import java.util.function.ToIntFunction;
import java.util.stream.Collectors;
/**
@@ -632,7 +630,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
mdPbGroupplateService.update(new GroupPlate(), new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
.eq(GroupPlate::getPcsn, ioStorInvDis.getPcsn())
.eq(GroupPlate::getMaterial_id, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getMaterial_code, ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStoragevehicle_code, ioStorInvDis.getStoragevehicle_code())
);
}

View File

@@ -420,7 +420,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
.set(GroupPlate::getUpdate_time, now)
.eq(GroupPlate::getStoragevehicle_code, outAllocation.getStoragevehicle_code())
.eq(GroupPlate::getPcsn, outAllocation.getPcsn())
.eq(GroupPlate::getMaterial_id, outAllocation.getMaterial_id())
.eq(GroupPlate::getMaterial_code, outAllocation.getMaterial_id())
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库")));
//生成分配明细
ioStorInvDisMapper.insert(ioStorInvDis);
@@ -607,7 +607,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
.set(GroupPlate::getUpdate_time, now)
.eq(GroupPlate::getStoragevehicle_code, outAllocation.getStoragevehicle_code())
.eq(GroupPlate::getPcsn, outAllocation.getPcsn())
.eq(GroupPlate::getMaterial_id, outAllocation.getMaterial_id())
.eq(GroupPlate::getMaterial_code, outAllocation.getMaterial_id())
.eq(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("入库")));
//生成分配明细
ioStorInvDisMapper.insert(ioStorInvDis);
@@ -1074,7 +1074,7 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
iMdPbGroupPlateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.eq(GroupPlate::getPcsn,ioStorInvDis.getPcsn())
.eq(GroupPlate::getMaterial_id,ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getMaterial_code,ioStorInvDis.getMaterial_id())
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.getStoragevehicle_code())
);
}

View File

@@ -0,0 +1,15 @@
package org.nl.wms.warehouse_manage.inventory;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
import java.util.List;
/**
* 库存查询服务
*/
public interface IStInventoryService {
public List<StInventoryDto> queryInventory(StInventoryQuery query);
}

View File

@@ -0,0 +1,17 @@
package org.nl.wms.warehouse_manage.inventory.dao.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
import java.util.List;
/**
* @author dsh
* 2025/5/21
*/
@Mapper
public interface StInventoryMapper {
List<StInventoryDto> queryInventory(StInventoryQuery query);
}

View File

@@ -0,0 +1,21 @@
<?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.warehouse_manage.inventory.dao.mapper.StInventoryMapper">
<select id="queryInventory" resultType="org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto">
SELECT
s.stor_id,
s.stor_code,
s.stor_name,
g.material_code,
SUM(g.qty - g.frozen_qty) AS available_qty, -- 可用库存
SUM(g.qty) AS total_qty -- 总库存
FROM md_pb_groupplate g
INNER JOIN st_ivt_structattr s
ON g.storagevehicle_code = s.storagevehicle_code
WHERE g.material_id = #{query.materialCode}
AND g.status != '03' -- 排除已移除/已禁用的组盘记录
AND s.is_used = 1 -- 只统计启用的仓位
GROUP BY s.stor_id, s.stor_code, s.stor_name, g.material_code
ORDER BY s.stor_code;
</select>
</mapper>

View File

@@ -0,0 +1,78 @@
package org.nl.wms.warehouse_manage.inventory.dto;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class StInventoryDto {
/**
* 组盘id
*/
private String groupId;
/**
* 存储车辆编码
*/
private String storagevehicleCode;
/**
* PC序列号/批次号
*/
private String pcsn;
/**
* 数量单位名称
*/
private String qtyUnitName;
/**
* 数量
*/
private BigDecimal qty; // 或 Double/Integer根据实际类型
/**
* 冻结数量
*/
private BigDecimal frozenQty;
/**
* 备注
*/
private String remark;
/**
* 创建时间
*/
private String createTime; // 或 Date
/**
* 结构编码
*/
private String structCode;
/**
* 结构名称
*/
private String structName;
/**
* 库位名称
*/
private String storName;
/**
* 区域名称
*/
private String sectName;
/**
* 物料编码
*/
private String materialCode;
/**
* 物料名称
*/
private String materialName;
}

View File

@@ -0,0 +1,18 @@
package org.nl.wms.warehouse_manage.inventory.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.nl.common.domain.query.BaseQuery;
import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class StInventoryQuery extends BaseQuery {
private String materialCode;
private String storCode;
}

View File

@@ -0,0 +1,27 @@
package org.nl.wms.warehouse_manage.inventory.impl;
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
import org.nl.wms.warehouse_manage.inventory.dao.mapper.StInventoryMapper;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryDto;
import org.nl.wms.warehouse_manage.inventory.dto.StInventoryQuery;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 库存查询服务
*/
@Service
public class StInventoryServiceImpl implements IStInventoryService {
@Resource
private StInventoryMapper stInventoryMapper;
@Override
public List<StInventoryDto> queryInventory(StInventoryQuery query){
List<StInventoryDto> result = stInventoryMapper.queryInventory(query);
return result;
};
}

View File

@@ -36,7 +36,7 @@ public class GroupPlate implements Serializable {
/**
* 物料编码
*/
private String material_id;
private String material_code;
/**

View File

@@ -26,7 +26,7 @@
mater.material_name
FROM
md_pb_groupplate late
INNER JOIN md_me_materialbase mater ON mater.material_id = late.material_id
INNER JOIN md_me_materialbase mater ON mater.material_code = late.material_code
<where>
1 = 1
<if test="param.material_code != null and param.material_code != ''">
@@ -61,7 +61,7 @@
mater.material_name
FROM
md_pb_groupplate gro
LEFT JOIN md_me_materialbase mater ON mater.material_id = gro.material_id
LEFT JOIN md_me_materialbase mater ON mater.material_code = gro.material_code
<where>
1 = 1
<if test="params.vehicleCode != null and params.vehicleCode != ''">

View File

@@ -151,7 +151,7 @@ public class UpdateIvtUtils {
GroupPlate extDao = iMdPbGroupPlateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
.eq(GroupPlate::getMaterial_code, where.getString("material_id"))
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
);
if (ObjectUtil.isEmpty(extDao)) {
@@ -183,7 +183,7 @@ public class UpdateIvtUtils {
GroupPlate extDao = iMdPbGroupPlateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
.eq(GroupPlate::getMaterial_code, where.getString("material_id"))
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
);
if (ObjectUtil.isEmpty(extDao)) {
@@ -218,7 +218,7 @@ public class UpdateIvtUtils {
GroupPlate extDao = iMdPbGroupPlateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
.eq(GroupPlate::getMaterial_code, where.getString("material_id"))
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库"))
);
@@ -244,7 +244,7 @@ public class UpdateIvtUtils {
GroupPlate extDao = iMdPbGroupPlateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
.eq(GroupPlate::getMaterial_code, where.getString("material_id"))
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
);
if (ObjectUtil.isEmpty(extDao)) {
@@ -268,7 +268,7 @@ public class UpdateIvtUtils {
GroupPlate extDao = iMdPbGroupPlateService.getOne(
new QueryWrapper<GroupPlate>().lambda()
.eq(GroupPlate::getStoragevehicle_code, where.getString("storagevehicle_code"))
.eq(GroupPlate::getMaterial_id, where.getString("material_id"))
.eq(GroupPlate::getMaterial_code, where.getString("material_id"))
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
);
if (ObjectUtil.isEmpty(extDao)) {

View File

@@ -0,0 +1,38 @@
-- MySQL 8.0+ 或 MariaDB 10.3+
-- 需求单主表
CREATE TABLE pm_demand_order (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '自增主键ID',
order_uuid VARCHAR(64) NOT NULL COMMENT '单据唯一ID业务主键',
creator VARCHAR(50) NOT NULL COMMENT '操作人',
create_time DATETIME NOT NULL COMMENT '需求日期',
priority INT NOT NULL COMMENT '优先级序号',
status INT DEFAULT 0 COMMENT '0生效1失效',
target_house_code VARCHAR(32) NOT NULL COMMENT '目标仓别',
remark VARCHAR(500) COMMENT '备注',
create_at DATETIME DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY uk_order_uuid (order_uuid)
) AUTO_INCREMENT=10000 COMMENT='需求单主表';
-- 需求单明细表
CREATE TABLE pmd_demand_dtl (
id BIGINT AUTO_INCREMENT PRIMARY KEY COMMENT '自增主键ID',
detail_uuid VARCHAR(64) NOT NULL COMMENT '明细唯一ID业务主键',
order_id BIGINT NOT NULL COMMENT '关联主表自增ID',
order_uuid VARCHAR(64) NOT NULL COMMENT '关联主表业务ID',
work_order VARCHAR(64) NOT NULL COMMENT '工单编号',
sku_code VARCHAR(64) NOT NULL COMMENT '物料编码',
sku_name VARCHAR(200) NOT NULL COMMENT '物料名称',
qty DECIMAL(18,4) NOT NULL COMMENT '数量',
unit VARCHAR(20) NOT NULL COMMENT '单位',
target_area VARCHAR(64) NOT NULL COMMENT '目标库存地点',
production_line VARCHAR(64) NOT NULL COMMENT '产线',
sn VARCHAR(64) COMMENT '车辆序列号',
max_load VARCHAR(50) COMMENT '最大装载量',
batch_no VARCHAR(64) COMMENT '批次号',
remark VARCHAR(500) COMMENT '备注',
create_at DATETIME DEFAULT CURRENT_TIMESTAMP,
UNIQUE KEY uk_detail_uuid (detail_uuid),
INDEX idx_order_id (order_id),
INDEX idx_order_uuid (order_uuid),
FOREIGN KEY (order_id) REFERENCES pm_demand_order(id) ON DELETE CASCADE
) AUTO_INCREMENT=10000 COMMENT='需求单明细表';

View File

@@ -24,4 +24,12 @@ export function edit(data) {
})
}
export default { add, edit, del }
export function getAllGroupInfo(data) {
return request({
url: 'api/group/getAllGroupInfo',
method: 'post',
data
})
}
export default { add, edit, del, getAllGroupInfo }

View File

@@ -179,6 +179,8 @@
</div>
<!--放引用的组件-->
<MaterialDialog :dialog-show.sync="materialDialog" @materialChoose="materialChoose" />
<AddDialog @AddChanged="querytable" />
</div>
</template>
@@ -190,6 +192,7 @@ import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import rrOperation from '@crud/RR.operation'
import MaterialDialog from '@/views/wms/basedata/material/MaterialDialog'
import AddDialog from '@/views/wms/basedata/group/AddDialog'
const defaultForm = {
group_id: null,
@@ -211,7 +214,7 @@ const defaultForm = {
}
export default {
name: 'Group',
components: { pagination, MaterialDialog, crudOperation, rrOperation, udOperation },
components: { pagination, MaterialDialog, crudOperation, rrOperation, udOperation, AddDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
tableEnums: ['md_pb_measureunit#unit_name#measure_unit_id'],
// 数据字典
@@ -243,6 +246,9 @@ export default {
[CRUD.HOOK.beforeRefresh]() {
return true
},
querytable() {
this.crud.toQuery()
},
formattStatus(row) {
return this.dict.label.GROUP_STATUS[row.status]
},

View File

@@ -0,0 +1,51 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/pmDemand',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/pmDemand',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/pmDemand',
method: 'put',
data
})
}
export function queryInventory(skuCode) {
return request({
url: 'api/pmDemand/queryInventory',
method: 'get',
params: { skuCode }
})
}
export function allocate(data) {
return request({
url: 'api/pmDemand/allocate',
method: 'post',
data
})
}
export function push(data) {
return request({
url: 'api/pmDemand/push',
method: 'post',
data
})
}
export default { add, edit, del, queryInventory, allocate, push }

View File

@@ -0,0 +1,262 @@
<template>
<div class="app-container">
<div class="head-container">
<div>
<el-form :inline="true" label-position="right" label-width="100px" label-suffix=":" class="demo-form-inline">
<el-form-item label="ID"><el-input v-model="query.id" clearable size="mini" placeholder="请输入ID" @keyup.enter.native="crud.toQuery" /></el-form-item>
<el-form-item label="操作人"><el-input v-model="query.creator" clearable size="mini" placeholder="请输入操作人" @keyup.enter.native="crud.toQuery" /></el-form-item>
<el-form-item label="工单编号"><el-input v-model="query.workOrder" clearable size="mini" placeholder="请输入工单编号" @keyup.enter.native="crud.toQuery" /></el-form-item>
<el-form-item label="物料编码"><el-input v-model="query.skuCode" clearable size="mini" placeholder="请输入物料编码/名称" @keyup.enter.native="crud.toQuery" /></el-form-item>
<el-form-item label="产线"><el-input v-model="query.productionLine" clearable size="mini" placeholder="请输入产线" @keyup.enter.native="crud.toQuery" /></el-form-item>
<el-form-item label="目标地点"><el-input v-model="query.targetArea" clearable size="mini" placeholder="请输入目标库存地点" @keyup.enter.native="crud.toQuery" /></el-form-item>
<el-form-item label="状态">
<el-select v-model="query.status" clearable size="mini" placeholder="请选择状态" class="filter-item" @change="crud.toQuery">
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="需求日期">
<el-date-picker v-model="query.datepick" type="daterange" value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item>
<rrOperation :crud="crud" />
</el-form>
</div>
<crudOperation :permission="permission" />
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="900px">
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px" label-suffix=":" style="border: 1px solid #cfe0df;margin-top: 10px;padding: 10px;">
<el-row>
<el-col :span="12"><el-form-item label="操作人" prop="creator"><el-input v-model.trim="form.creator" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="需求日期" prop="createTime"><el-date-picker v-model="form.createTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择需求日期" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="优先级" prop="priority"><el-input-number v-model="form.priority" :min="0" :max="99999" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="状态" prop="status"><el-select v-model="form.status" style="width: 280px;" placeholder="请选择状态"><el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" /></el-select></el-form-item></el-col>
<el-col :span="12"><el-form-item label="工单编号" prop="workOrder"><el-input v-model.trim="form.workOrder" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="物料编码" prop="skuCode"><el-input v-model.trim="form.skuCode" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="物料名称" prop="skuName"><el-input v-model.trim="form.skuName" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="数量" prop="qty"><el-input-number v-model="form.qty" :min="0" :precision="4" :step="1" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="单位" prop="unit"><el-input v-model.trim="form.unit" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="目标库存地点" prop="targetArea"><el-input v-model.trim="form.targetArea" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="产线" prop="productionLine"><el-input v-model.trim="form.productionLine" style="width: 280px;" /></el-form-item></el-col>
<el-col :span="12"><el-form-item label="车辆序列号" prop="sn"><el-input v-model.trim="form.sn" style="width: 280px;" /></el-form-item></el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer"><el-button type="text" @click="crud.cancelCU">取消</el-button><el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button></div>
</el-dialog>
<!-- 库存分配对话框 -->
<el-dialog :visible.sync="allocateVisible" title="库存分配" width="820px" :close-on-click-modal="false" @close="closeAllocateDialog">
<div style="margin-bottom:10px;color:#606266;font-size:13px;">
需求单:<strong>{{ currentDemand.workOrder }}</strong> &nbsp;|&nbsp;
物料:<strong>{{ currentDemand.skuCode }} {{ currentDemand.skuName }}</strong> &nbsp;|&nbsp;
需求数量:<strong style="color:#E6A23C;">{{ currentDemand.qty }} {{ currentDemand.unit }}</strong>
</div>
<el-table ref="allocateTable" :data="inventoryList" size="small" border v-loading="inventoryLoading" @selection-change="handleInventorySelection">
<el-table-column type="selection" width="45" />
<el-table-column prop="houseCode" label="仓库编号" min-width="130" show-overflow-tooltip />
<el-table-column prop="houseName" label="仓库名称" min-width="140" show-overflow-tooltip />
<el-table-column prop="skuCode" label="物料编码" min-width="130" show-overflow-tooltip />
<el-table-column prop="qty" label="库存数量" width="110" />
<el-table-column label="分配数量" width="160">
<template slot-scope="scope">
<el-input-number v-model="scope.row.allocQty" :min="0" :max="scope.row.qty" :precision="4" size="mini" style="width:130px;" :disabled="!scope.row._selected" />
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="closeAllocateDialog">取消</el-button>
<el-button size="mini" type="primary" :loading="allocateSaving" @click="saveAllocate">保存分配</el-button>
</div>
</el-dialog>
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small">
<el-table-column type="selection" width="55" />
<el-table-column prop="id" label="ID" width="220" show-overflow-tooltip />
<el-table-column prop="creator" label="操作人" min-width="100" show-overflow-tooltip />
<el-table-column prop="createTime" label="需求日期" min-width="160" show-overflow-tooltip />
<el-table-column prop="priority" label="优先级" width="80" />
<el-table-column prop="status" label="状态" width="90">
<template slot-scope="scope">
<el-tag :type="statusTagType(scope.row.status)" size="mini">{{ statusLabel(scope.row.status) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="workOrder" label="工单编号" min-width="140" show-overflow-tooltip />
<el-table-column prop="skuCode" label="物料编码" min-width="140" show-overflow-tooltip />
<el-table-column prop="skuName" label="物料名称" min-width="180" show-overflow-tooltip />
<el-table-column prop="qty" label="数量" width="100" />
<el-table-column prop="unit" label="单位" width="80" />
<el-table-column prop="targetArea" label="目标库存地点" min-width="140" show-overflow-tooltip />
<el-table-column prop="productionLine" label="产线" min-width="100" show-overflow-tooltip />
<el-table-column prop="sn" label="车辆序列号" min-width="140" show-overflow-tooltip />
<el-table-column prop="createAt" label="创建时间" min-width="160" show-overflow-tooltip />
<el-table-column label="操作" width="240px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation style="display: inline" :data="scope.row" :permission="permission" />
<el-button size="mini" type="warning" plain style="margin-left:4px;" @click="openAllocateDialog(scope.row)">分配</el-button>
<el-button size="mini" type="success" plain style="margin-left:4px;" :disabled="scope.row.status !== '01'" @click="handlePush(scope.row)">下发</el-button>
</template>
</el-table-column>
</el-table>
<pagination />
</div>
</div>
</template>
<script>
import crudDemand, { queryInventory, allocate, push } from './demand'
import CRUD, { crud, form, header, presenter } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation.vue'
import udOperation from '@crud/UD.operation.vue'
import rrOperation from '@crud/RR.operation.vue'
import pagination from '@crud/Pagination.vue'
const createDefaultForm = () => ({ id: null, creator: '', createTime: '', priority: 0, status: 0, workOrder: '', skuCode: '', skuName: '', qty: undefined, unit: '', targetArea: '', productionLine: '', sn: '' })
export default {
name: 'Demand',
components: { pagination, crudOperation, rrOperation, udOperation },
mixins: [presenter(), header(), form(createDefaultForm()), crud()],
cruds() {
return CRUD({ title: '需求单', url: 'api/pmDemand', idField: 'id', sort: 'priority,desc', crudMethod: { ...crudDemand }, optShow: { add: true, reset: true } })
},
data() {
return {
permission: {},
statusOptions: [
{ value: 0, label: '生成' },
{ value: '01', label: '分配' },
{ value: '10', label: '下发' },
{ value: '20', label: '执行' },
{ value: '80', label: '完成' },
{ value: '90', label: '取消' }
],
allocateVisible: false,
inventoryLoading: false,
allocateSaving: false,
currentDemand: {},
inventoryList: [],
selectedInventory: [],
rules: {
creator: [{ required: true, message: '请输入操作人', trigger: 'blur' }],
createTime: [{ required: true, message: '请选择需求日期', trigger: 'change' }],
priority: [{ required: true, message: '请输入优先级', trigger: 'change' }],
workOrder: [{ required: true, message: '请输入工单编号', trigger: 'blur' }],
skuCode: [{ required: true, message: '请输入物料编码', trigger: 'blur' }],
skuName: [{ required: true, message: '请输入物料名称', trigger: 'blur' }],
qty: [{ required: true, message: '请输入数量', trigger: 'change' }],
unit: [{ required: true, message: '请输入单位', trigger: 'blur' }],
targetArea: [{ required: true, message: '请输入目标库存地点', trigger: 'blur' }],
productionLine: [{ required: true, message: '请输入产线', trigger: 'blur' }]
}
}
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
if (this.query.datepick) {
this.query.startTime = this.query.datepick[0]
this.query.endTime = this.query.datepick.length > 1 ? this.query.datepick[1] : this.query.datepick[0]
} else {
this.query.startTime = ''
this.query.endTime = ''
}
},
statusLabel(status) {
const target = this.statusOptions.find(item => String(item.value) === String(status))
return target ? target.label : status
},
statusTagType(status) {
const map = { 0: '', '01': 'warning', '10': 'primary', '20': 'primary', '80': 'success', '90': 'danger' }
return map[String(status)] || ''
},
openAllocateDialog(row) {
this.currentDemand = { ...row }
this.inventoryList = []
this.selectedInventory = []
this.allocateVisible = true
this.inventoryLoading = true
queryInventory(row.skuCode).then(res => {
const demandQty = Number(row.qty) || 0
this.inventoryList = (res || []).map(item => ({
...item,
_selected: false,
allocQty: Math.min(Number(item.qty) || 0, demandQty)
}))
if (row.inventoryDis) {
try {
const saved = JSON.parse(row.inventoryDis)
this.inventoryList.forEach(item => {
const match = saved.find(s => s.houseCode === item.houseCode)
if (match) {
item._selected = true
item.allocQty = match.allocQty
this.$nextTick(() => {
this.$refs.allocateTable && this.$refs.allocateTable.toggleRowSelection(item, true)
})
}
})
} catch (e) { }
}
}).finally(() => {
this.inventoryLoading = false
})
},
closeAllocateDialog() {
this.allocateVisible = false
this.currentDemand = {}
this.inventoryList = []
this.selectedInventory = []
},
handleInventorySelection(selection) {
this.selectedInventory = selection
this.inventoryList.forEach(item => {
item._selected = selection.some(s => s.houseCode === item.houseCode)
})
},
saveAllocate() {
if (!this.selectedInventory.length) {
this.$message.warning('请至少勾选一条库存记录')
return
}
const invalidRow = this.selectedInventory.find(item => !item.allocQty || item.allocQty <= 0)
if (invalidRow) {
this.$message.warning(`仓库 ${invalidRow.houseCode} 的分配数量必须大于0`)
return
}
const inventoryDis = JSON.stringify(
this.selectedInventory.map(item => ({
houseCode: item.houseCode,
houseName: item.houseName,
skuCode: item.skuCode,
skuName: item.skuName,
qty: item.qty,
allocQty: item.allocQty
}))
)
this.allocateSaving = true
allocate({ id: this.currentDemand.id, inventoryDis }).then(() => {
this.$message.success('库存分配成功')
this.closeAllocateDialog()
this.crud.toQuery()
}).catch(() => {
this.$message.error('库存分配失败')
}).finally(() => {
this.allocateSaving = false
})
},
handlePush(row) {
this.$confirm(`确认下发需求单 "${row.workOrder}" `, '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
push({ id: row.id, workOrder: row.workOrder }).then(() => {
this.$message.success('下发成功')
this.crud.toQuery()
}).catch(() => {
this.$message.error('下发失败')
})
}).catch(() => {})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -313,7 +313,7 @@ export default {
rows.forEach((item) => {
let same_mater = true
this.form.tableData.forEach((row) => {
if (row.pcsn === item.pcsn) {
if (row.pcsn === item.pcsn && row.material_id === item.material_id && row.storagevehicle_code === item.storagevehicle_code) {
same_mater = false
}
})

View File

@@ -77,12 +77,12 @@ import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker/index'
import crudRawAssist from '@/views/wms/st/inbill/rawassist'
import group, { getAllGroupInfo } from '@/views/wms/basedata/group/group.js'
const start = new Date()
export default {
name: 'AddDtl',
components: { crudOperation, rrOperation, pagination, DateRangePicker },
components: { crudOperation, rrOperation, pagination, DateRangePicker, group },
cruds() {
return CRUD({
title: '用户',
@@ -149,10 +149,10 @@ export default {
console.log('获取的rows:')
console.log(this.rows)
this.$emit('tableChanged', this.rows)
// crudRawAssist.queryBoxMater(this.rows).then(res => {
// this.rows = res
// this.$emit('tableChanged', this.rows)
// })
group.getAllGroupInfo(this.rows).then(res => {
this.rows = res.content
this.$emit('tableChanged', this.rows)
})
// this.form = this.$options.data().form
}
}

View File

@@ -72,6 +72,20 @@
label="数量"
align="center"
/>
<el-table-column
show-overflow-tooltip
prop="assign_qty"
:formatter="crud.formatNum3"
label="分配数量"
align="center"
/>
<el-table-column
show-overflow-tooltip
prop="unassign_qty"
:formatter="crud.formatNum3"
label="未分配数量"
align="center"
/>
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="单位" align="center" />
<el-table-column show-overflow-tooltip prop="source_bill_code" label="源单号" align="center" />
<el-table-column show-overflow-tooltip prop="source_bill_type" label="源单类型" align="center" />
@@ -155,10 +169,13 @@
:data="form.tableMater"
style="width: 100%;"
max-height="300"
highlight-current-row
@row-click="clcikDisRow"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column show-overflow-tooltip type="index" label="序号" align="center" />
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="载具编码" align="center" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip prop="pcsn" label="批次号" align="center" />
@@ -215,7 +232,7 @@ export default {
type: String,
default: null
},
storId: {
storCode: {
type: String,
default: null
}
@@ -236,6 +253,7 @@ export default {
sect_val: null,
form: {
dtl_row: null,
dis_row: null,
storage_qty: '',
point_code: null,
checked: true,
@@ -255,7 +273,7 @@ export default {
},
methods: {
open() {
crudSectattr.getSectCode({ 'stor_id': this.storId }).then(res => {
crudSectattr.getSectCode({ 'stor_code': this.storCode }).then(res => {
this.sects = res.content
})
@@ -283,11 +301,15 @@ export default {
crudRawAssist.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
this.openParam = res
this.form.dtl_row = res[row.index]
this.form.dis_row = null
})
crudRawAssist.getDisDtl(row).then(res => {
this.form.tableMater = res
})
},
clcikDisRow(row, column, event) {
this.form.dis_row = row
},
tableRowClassName({ row, rowIndex }) {
row.index = rowIndex
},
@@ -369,6 +391,10 @@ export default {
this.crud.notify('请先选择一条明细!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (!this.form.dis_row) {
this.crud.notify('请先选择一条分配明细!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
// 如果勾选了,直接跳后台
if (this.form.checked) {
if (!this.sect_code) {
@@ -385,6 +411,7 @@ export default {
crudRawAssist.getDisDtl(this.form.dtl_row).then(res => {
this.form.tableMater = res
this.divBtn = false
this.form.dis_row = null
this.crud.notify('分配货位成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
}).finally(() => {
@@ -403,9 +430,8 @@ export default {
this.crud.notify('不存在载具明细!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
const flag = this.form.tableMater.some(mater => !mater.struct_code)
if (flag) {
this.crud.notify('明细存在未分配货位!', CRUD.NOTIFICATION_TYPE.INFO)
if (!this.form.dis_row) {
this.crud.notify('请先选择一条分配明细!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
// 如果勾选了,直接跳后台
@@ -415,6 +441,7 @@ export default {
})
crudRawAssist.getDisDtl(this.form.dtl_row).then(res => {
this.form.tableMater = res
this.form.dis_row = null
this.crud.notify('取消分配成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
})

View File

@@ -379,7 +379,7 @@ export default {
divOpen() {
crudRawAssist.getIODtl({ 'bill_code': this.currentRow.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.storId = this.currentRow.stor_id
this.storCode = this.currentRow.stor_code
this.billType = this.currentRow.bill_type
this.divShow = true
})

View File

@@ -1,97 +0,0 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: '/api/in/rawAssist',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: '/api/in/rawAssist',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: '/api/in/rawAssist',
method: 'put',
data
})
}
export function getIODtl(params) {
return request({
url: '/api/in/rawAssist/getIODtl',
method: 'get',
params
})
}
export function commit(data) {
return request({
url: '/api/in/rawAssist/commit',
method: 'post',
data
})
}
export function deleteDisDtl(data) {
return request({
url: '/api/in/rawAssist/deleteDisDtl',
method: 'post',
data
})
}
export function getDisDtl(data) {
return request({
url: '/api/in/rawAssist/getDisDtl',
method: 'post',
data
})
}
export function divStruct(data) {
return request({
url: '/api/in/rawAssist/divStruct',
method: 'post',
data
})
}
export function unDivStruct(data) {
return request({
url: '/api/in/rawAssist/unDivStruct',
method: 'post',
data
})
}
export function divPoint(data) {
return request({
url: '/api/in/rawAssist/divPoint',
method: 'post',
data
})
}
export function confirm(data) {
return request({
url: '/api/in/rawAssist/confirm',
method: 'post',
data
})
}
export function getInBillTaskDtl(data) {
return request({
url: '/api/in/rawAssist/getInBillTaskDtl',
method: 'post',
data
})
}
export default { add, edit, del, getIODtl, commit,
deleteDisDtl, getDisDtl, divStruct, unDivStruct, divPoint, confirm, getInBillTaskDtl }

View File

@@ -157,21 +157,14 @@
disabled
/>
</el-form-item>
<el-form-item label="出库" prop="point_code">
<el-select
v-model="form2.point_code"
clearable
<el-form-item label="出库" prop="gender2">
<el-cascader
placeholder="请选择"
class="filter-item"
style="width: 150px;"
>
<el-option
v-for="item in pointList"
:key="item.point_code"
:label="item.point_name"
:value="item.point_code"
:options="outBoundRegion"
:props="{ checkStrictly: true }"
clearable
@change="outBoundChange"
/>
</el-select>
</el-form-item>
</el-form>
</div>
@@ -211,6 +204,7 @@
<el-table-column prop="material_name" label="物料名称" width="170px" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="storagevehicle_code" label="载具号" width="150px" :min-width="flexWidth('storagevehicle_code',crud.data,'载具号')" />
<el-table-column prop="pcsn" label="批次号" width="150px" :min-width="flexWidth('pcsn',crud.data,'批次号')" />
<el-table-column show-overflow-tooltip prop="qty" label="物料总数" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" align="center" width="120px" :min-width="flexWidth('plan_qty',crud.data,'出库重量')">
<template scope="scope">
<el-input-number v-show="mstrow.bill_type === '1011'" v-model="scope.row.plan_qty" :precision="3" :controls="false" :min="1" style="width: 90px" />
@@ -239,7 +233,7 @@ import CRUD, { crud } from '@crud/crud'
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
import StructIvt from '@/views/wms/st/outbill/StructIvt'
import PointDialog from '@/views/wms/sch/point/PointDialog'
import crudPoint from '@/views/wms/sch/point/schBasePoint'
import crudPoint, { getRegionPoints } from '@/views/wms/sch/point/schBasePoint'
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
import { autoCancel, getOutBillDis } from './checkoutbill'
@@ -260,7 +254,7 @@ export default {
type: Array,
default: () => { return [] }
},
storId: {
storCode: {
type: String,
default: null
}
@@ -292,9 +286,11 @@ export default {
form2: {
unassign_qty: '0',
assign_qty: '0',
point_code: ''
point_code: '',
region_code: ''
},
sects: [],
outBoundRegion: [],
pointList: [],
rules: {
}
@@ -320,13 +316,11 @@ export default {
},
methods: {
open() {
crudSectattr.getSectCode({ 'stor_id': this.storId }).then(res => {
crudSectattr.getSectCode({ 'stor_code': this.storCode }).then(res => {
this.sects = res.content
})
const area_type = 'CKQ'
crudPoint.getPointList({ 'region_code': area_type }).then(res => {
this.pointList = res
crudPoint.getRegionPoints({ 'region_code': 'CKQ' }).then(res => {
this.outBoundRegion = res.content
})
},
close() {
@@ -340,10 +334,11 @@ export default {
},
PointChanged(row) {
this.form2.point_code = row.point_code
this.form2.region_code = row.region_code
},
openStructIvt() {
this.currentRow.remark = ''
this.currentRow.stor_id = this.storId
this.currentRow.stor_code = this.storCode
this.loadingAlldiv = true
checkoutbill.getStructIvt(this.currentRow).then(res => {
this.openParam = res
@@ -368,6 +363,20 @@ export default {
this.mstrow.sect_code = val[1]
}
},
outBoundChange(val) {
if (val.length === 1) {
this.form2.region_code = val[0]
this.form2.point_code = ''
}
if (val.length === 0) {
this.form2.region_code = ''
this.form2.point_code = ''
}
if (val.length === 2) {
this.form2.region_code = val[0]
this.form2.point_code = val[1]
}
},
tabledisabled(row) {
if ((row.work_status === '00' || row.work_status === '01') && row.is_issued === '0') {
return false
@@ -460,13 +469,14 @@ export default {
}
},
allSetPointAllDtl() {
if (this.form2.point_code === '') {
if (this.form2.regon_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.loadingSetAllPoint = true
const data = {
'point_code': this.form2.point_code,
'region_code': this.form2.region_code,
'iostorinv_id': this.mstrow.iostorinv_id,
'bill_code': this.mstrow.bill_code,
'checked': this.checked

View File

@@ -93,7 +93,11 @@
<el-table-column show-overflow-tooltip prop="storagevehicle_code" label="托盘编码" align="center" width="250px" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip sortable prop="pcsn" label="批次号" align="center" width="150px" />
<el-table-column show-overflow-tooltip prop="canuse_qty" label="可出重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="qty" label="可出重量" :formatter="crud.formatNum3" align="center" >
<template slot-scope="scope">
<el-input v-model="scope.row.qty" clearable style="width: 120px"></el-input>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="160" fixed="right">
<template scope="scope">
<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>
@@ -200,15 +204,15 @@ export default {
}
row.edit = !row.edit
if (row.edit) {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - parseFloat(row.canuse_qty)
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + parseFloat(row.canuse_qty)
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - parseFloat(row.qty)
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + parseFloat(row.qty)
} else {
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - parseFloat(row.canuse_qty)
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - parseFloat(row.qty)
// 如果待分配重量等于0则 明细重量 - 已分配重量
if (parseInt(this.queryrow.unassign_qty) === 0) {
this.queryrow.unassign_qty = parseFloat(this.goal_unassign_qty) - parseFloat(this.queryrow.assign_qty)
} else {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(row.canuse_qty)
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(row.qty)
}
if (this.queryrow.unassign_qty > this.goal_unassign_qty) {
this.queryrow.unassign_qty = JSON.parse(JSON.stringify(this.goal_unassign_qty))

View File

@@ -203,7 +203,7 @@
</div>
<AddDialog @AddChanged="querytable" />
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
<DivDialog :dialog-show.sync="divShow" :open-array="openParam" :stor-id="storId" :rowmst="mstrow" @DivChanged="querytable" />
<DivDialog :dialog-show.sync="divShow" :open-array="openParam" :stor-code="storCode" :rowmst="mstrow" @DivChanged="querytable" />
</div>
</template>
@@ -262,7 +262,7 @@ export default {
checkrows: [],
storlist: [],
billtypelist: [],
storId: null
storCode: null
}
},
mounted: function() {
@@ -382,7 +382,7 @@ export default {
divOpen() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
this.openParam = res
this.storId = this.currentRow.stor_id
this.storCode = this.currentRow.stor_code
this.divShow = true
this.mstrow = this.currentRow
})