This commit is contained in:
2023-04-03 19:49:12 +08:00
15 changed files with 4632 additions and 26 deletions

View File

@@ -10,6 +10,7 @@ import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.wms.basedata.st.service.dto.StructattrDto;
import org.nl.wms.basedata.st.service.impl.StructattrServiceImpl;
import org.nl.wms.sch.manage.AbstractAcsTask;
@@ -33,14 +34,18 @@ public class ProductInTask extends AbstractAcsTask {
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配表
WQLObject mstTab = WQLObject.getWQLObject("ST_IVT_IOStorInv"); // 出入库主表
WQLObject dtlTab = WQLObject.getWQLObject("ST_IVT_IOStorInvDtl"); // 出入库明细表
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
WQLObject pointTab = WQLObject.getWQLObject("sch_base_point"); // 点位表
WQLObject taskTab = WQLObject.getWQLObject("sch_base_task"); // 任务表表
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
HashMap<String, String> map = new HashMap<>();
JSONObject jsonTask = taskTab.query("task_id = '" + taskObj.getString("task_id") + "'").uniqueResult(0);
//1:执行中,2:完成 ,0:acs取消
//1:执行中,2:完成 ,3:acs取消
if (StrUtil.equals(status, "1")) {
map.put("task_status", TaskStatusEnum.EXECUTING.getCode());
//更新入库单分配任务状态
@@ -57,10 +62,7 @@ public class ProductInTask extends AbstractAcsTask {
dis_form.put("task_id", taskObj.getString("task_id"));
productInService.confirmDis(dis_form);
}
if (StrUtil.equals(status, "0")) {
WQLObject point_table = WQLObject.getWQLObject("SCH_BASE_Point");
WQLObject struct_table = WQLObject.getWQLObject("ST_IVT_StructAttr");
if (StrUtil.equals(status, "3")) {
if (taskObj.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.ISSUE.getCode())) {
throw new BadRequestException("任务已执行不能取消");
}
@@ -73,33 +75,37 @@ public class ProductInTask extends AbstractAcsTask {
String iostorinv_id = jsonDis.getString("iostorinv_id");
// 解锁货位
HashMap<String, String> unlock_map = new HashMap<>();
unlock_map.put("lock_type", "1");
unlock_map.put("taskdtl_type", "");
unlock_map.put("taskdtl_id", "");
unlock_map.put("task_code", "");
unlock_map.put("inv_type", "");
unlock_map.put("inv_id", "");
unlock_map.put("inv_code", "");
point_table.update(unlock_map, "point_code = '" + taskObj.get("point_code2") + "'");
struct_table.update(unlock_map, "struct_code = '" + taskObj.get("point_code2") + "'");
JSONObject jsonPoint1 = pointTab.query("point_code = '" + jsonTask.getString("point_code2") + "'").uniqueResult(0);
jsonPoint1.put("lock_type", "1");
pointTab.update(jsonPoint1);
// 判断物料是否超长: 超长解锁对应点位
JSONObject jsonMater = materTab.query("material_id = '" + jsonDis.getString("material_id") + "'").uniqueResult(0);
String length_up = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("MATERIAL_LENGTH_UP").getValue();
double material_length = jsonMater.getDoubleValue("length");
double material_length_up = Double.valueOf(length_up);
if (material_length > material_length_up) {
JSONObject jsonPoint2 = pointTab.query("point_id = '" + jsonPoint1.getString("control_point") + "'").uniqueResult(0);
jsonPoint2.put("lock_type","1");
pointTab.update(jsonPoint2);
}
//减去原货位的待入数
JSONArray dis_rows = disTab.query("struct_code = '" + taskObj.get("point_code2") + "' AND work_status < '99'").getResultJSONArray(0);
JSONArray dis_rows = disTab.query("struct_code = '" + jsonTask.get("point_code2") + "' AND work_status < '99'").getResultJSONArray(0);
if (dis_rows.size() <= 0) {
throw new BadRequestException("数据参数有误!");
}
StructattrDto old_struct = new StructattrServiceImpl().findByCode(taskObj.getString("point_code2"));
JSONObject mst_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '" + dis_rows.getJSONObject(0).getString("iostorinv_id") + "'").uniqueResult(0);
for (int i = 0; i < dis_rows.size(); i++) {
JSONObject i_form = new JSONObject();
JSONObject dis_row = dis_rows.getJSONObject(i);
i_form.put("struct_id", old_struct.getStruct_id());
i_form.put("struct_id", jsonPoint1.getString("point_id"));
i_form.put("material_id", dis_row.getString("material_id"));
i_form.put("quality_scode", dis_row.getString("quality_scode"));
i_form.put("quality_scode", "01");
i_form.put("pcsn", dis_row.getString("pcsn"));
i_form.put("ivt_level", dis_row.getString("ivt_level"));
i_form.put("change_qty", dis_row.getString("plan_qty"));
i_form.put("bill_type_scode", mst_jo.getString("bill_type"));
i_form.put("inv_id", mst_jo.getString("iostorinv_id"));
@@ -112,7 +118,7 @@ public class ProductInTask extends AbstractAcsTask {
// 修改主表状态为分配中30
JSONObject mstMap = new JSONObject();
mstMap.put("bill_status", "30");
mstMap.put("bill_status", "20");
mstMap.put("update_optid", currentUserId);
mstMap.put("update_optname", nickName);
mstMap.put("update_time", now);
@@ -128,9 +134,6 @@ public class ProductInTask extends AbstractAcsTask {
disMap.put("work_status", "00");
disMap.put("point_id", "");
disMap.put("task_id", "");
disMap.put("sect_id", "");
disMap.put("sect_code", "");
disMap.put("sect_name", "");
disMap.put("struct_id", "");
disMap.put("struct_code", "");
disMap.put("struct_name", "");
@@ -176,7 +179,7 @@ public class ProductInTask extends AbstractAcsTask {
json.put("point_code1", start_device_code);
json.put("point_code2", next_device_code);
json.put("vehicle_code", form.getString("vehicle_code"));
json.put("handle_class", this.getClass().getName());
json.put("handle_class", THIS_CLASS);
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());
@@ -194,7 +197,6 @@ public class ProductInTask extends AbstractAcsTask {
this.updateTaskStatus(taskObj, "0");
}
@Override
public void pointConfirm(JSONObject param) {

View File

@@ -0,0 +1,121 @@
package org.nl.wms.sch.tasks;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.wms.sch.manage.AbstractAcsTask;
import org.nl.wms.sch.manage.TaskStatusEnum;
import org.nl.wms.st.out.service.impl.ProductOutServiceImpl;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* Created by Lxy on 2021/12/22.
*/
@Component
@RequiredArgsConstructor
public class ProductOutTask extends AbstractAcsTask {
private final String THIS_CLASS = ProductOutTask.class.getName();
@Override
@Transactional(rollbackFor = Exception.class)
public void updateTaskStatus(JSONObject taskObj, String status) {
WQLObject taskTab = WQLObject.getWQLObject("SCH_BASE_Task"); // 任务表
WQLObject disTab = WQLObject.getWQLObject("st_ivt_iostorinvdis"); // 出入库分配表
String task_id = taskObj.getString("task_id");
JSONObject jsonTask = taskTab.query("task_id = '" + task_id + "' and task_status < '7'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonTask)) {
if (StrUtil.equals(status, "3")) {
// 任务为下发之后就不允许取消
if (jsonTask.getIntValue("task_status") > Integer.valueOf(TaskStatusEnum.START_AND_POINT.getCode())) {
throw new BadRequestException("任务:"+jsonTask.getString("task_code")+"已下发,不可取消");
}
// 更新删除字段
jsonTask.put("is_delete","1");
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
// 更新分配明细为:未生成
JSONObject map = new JSONObject();
map.put("work_status", "00");
map.put("point_id", "");
disTab.update(map,"task_id = '"+task_id+"'");
}
if (TaskStatusEnum.EXECUTING.getCode().equals(status)) {
// 更新任务状态为执行中
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
}
if (StrUtil.equals(status, "2")) {
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
// 调用标识完成
ProductOutServiceImpl productOutService = SpringContextHolder.getBean(ProductOutServiceImpl.class);
productOutService.finishTask(jsonTask);
// 更改任务状态为完成
jsonTask.put("task_status", TaskStatusEnum.FINISHED.getCode());
jsonTask.put("update_optid", currentUserId);
jsonTask.put("update_optname", currentUsername);
jsonTask.put("update_time", DateUtil.now());
taskTab.update(jsonTask);
}
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public String createTask(JSONObject form) {
String currentUserId = SecurityUtils.getCurrentUserId();
String currentUsername = SecurityUtils.getCurrentUsername();
JSONObject json = new JSONObject();
json.put("task_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("task_code", IdUtil.getSnowflake(1,1).nextId());
json.put("product_area", form.getString("product_area"));
json.put("task_type", form.getString("task_type"));
json.put("is_send", "1");
json.put("task_status", TaskStatusEnum.START_AND_POINT.getCode());
json.put("point_code1", form.getString("point_code1"));
json.put("point_code2", form.getString("point_code2"));
json.put("vehicle_code", form.getString("vehicle_code"));
json.put("handle_class", THIS_CLASS);
json.put("create_id", currentUserId);
json.put("create_name", currentUsername);
json.put("create_time", DateUtil.now());
json.put("update_id", currentUserId);
json.put("update_name", currentUsername);
json.put("update_time", DateUtil.now());
WQLObject.getWQLObject("SCH_BASE_Task").insert(json);
return json.getString("task_id");
}
@Override
public void cancel(String task_id) {
JSONObject taskObj = WQLObject.getWQLObject("SCH_BASE_Task").query("task_id = '" + task_id + "'").uniqueResult(0);
this.updateTaskStatus(taskObj, "0");
}
@Override
public void pointConfirm(JSONObject param) {
}
}

View File

@@ -0,0 +1,164 @@
package org.nl.wms.st.out.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.anno.Log;
import org.nl.wms.st.out.service.ProductOutService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@Api(tags = "成品出库")
@RequestMapping("/api/productOut")
@Slf4j
public class ProductOutController {
private final ProductOutService productOutService;
@GetMapping
@Log("查询出库单")
@ApiOperation("查询出库单")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(productOutService.pageQuery(whereJson,page), HttpStatus.OK);
}
@GetMapping("/addDtl")
@Log("查询库存")
@ApiOperation("查询库存")
public ResponseEntity<Object> queryAddDtl(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(productOutService.queryAddDtl(whereJson,page), HttpStatus.OK);
}
@GetMapping("/queryDtl")
@Log("查询明细")
@ApiOperation("查询明细")
public ResponseEntity<Object> queryDtl(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(productOutService.queryDtl(whereJson,page), HttpStatus.OK);
}
@PostMapping("/getOutBillDtl")
@Log("查询分配明细")
@ApiOperation("查询分配明细")
public ResponseEntity<Object> getOutBillDtl(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(productOutService.getOutBillDtl(whereJson), HttpStatus.OK);
}
@Log("删除出库单")
@ApiOperation("删除出库单")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
productOutService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@PutMapping
@Log("修改出库单")
@ApiOperation("修改出库单")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson){
productOutService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping()
@Log("新增出库单")
@ApiOperation("新增出库单")
public ResponseEntity<Object> insertDtl(@RequestBody JSONObject whereJson){
productOutService.insertDtl(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PostMapping("/allDiv")
@Log("出库单全部分配")
@ApiOperation("出库单全部分配")
public ResponseEntity<Object> allDiv(@RequestBody JSONObject whereJson) {
productOutService.allDiv(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/allDivOne")
@Log("分配一条出库明细")
@ApiOperation("分配一条出库明细")
public ResponseEntity<Object> allDivOne(@RequestBody JSONObject whereJson) {
productOutService.allDivOne(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/allCancel")
@Log("出库单全部取消")
@ApiOperation("出库单全部取消")
public ResponseEntity<Object> allCancel(@RequestBody JSONObject whereJson) {
productOutService.allCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/oneCancel")
@Log("出库单全部取消")
@ApiOperation("出库单全部取消")
public ResponseEntity<Object> oneCancel(@RequestBody JSONObject whereJson) {
productOutService.oneCancel(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/getOutBillDis")
@Log("查询出库单分配明细")
@ApiOperation("查询出库单分配明细")
public ResponseEntity<Object> getOutBillDis(@RequestBody JSONObject whereJson){
return new ResponseEntity<>(productOutService.getOutBillDis(whereJson), HttpStatus.OK);
}
@PostMapping("/allSetPoint")
@Log("设置全部站点")
@ApiOperation("设置全部站点")
public ResponseEntity<Object> allSetPoint(@RequestBody JSONObject whereJson) {
productOutService.allSetPoint(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/manualDiv")
@Log("出库单手动分配")
@ApiOperation("出库单手动分配")
public ResponseEntity<Object> manualDiv(@RequestBody JSONObject whereJson) {
productOutService.manualDiv(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/confirm")
@Log("出库单强制确认")
@ApiOperation("出库单强制确认")
public ResponseEntity<Object> confirm(@RequestBody JSONObject whereJson) {
productOutService.confirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/finishTask")
@Log("出库任务手动完成")
@ApiOperation("出库任务手动完成")
public ResponseEntity<Object> finishTask(@RequestBody JSONObject whereJson) {
productOutService.finishTask(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@PostMapping("/backConfirm")
@Log("出库单强制确认")
@ApiOperation("出库单强制确认")
public ResponseEntity<Object> backConfirm(@RequestBody JSONObject whereJson) {
productOutService.backConfirm(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("下载发货单Excel")
@ApiOperation("下载发货单Excel")
@GetMapping(value = "/downloadExcel")
public ResponseEntity<Object> downloadExcel(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
productOutService.downloadExcel(response,whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,121 @@
package org.nl.wms.st.out.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
public interface ProductOutService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> pageQuery(Map whereJson, Pageable page);
/**
* 查询库存数据
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAddDtl(Map whereJson, Pageable page);
/**
* 查询明细
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryDtl(Map whereJson, Pageable page);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 新增出库单
* @param whereJson
* 参数举例:
* {bill_code=, stor_id=1473161852946092032, stor_code=01, stor_name=原材料库, bill_status=10, total_qty=2, detail_count=1, bill_type=010201, remark=, biz_date=2022-01-08, create_mode=, tableData=[{material_id=1309, material_code=090301010001, bill_status=10, material_name=碳化钨粉 02, pcsn=, quality_scode=02, ivt_level=01, is_active=1, plan_qty=2, qty_unit_name=千克\公斤, qty_unit_id=1, remark=, edit=true}]}
* /
*/
String insertDtl (JSONObject whereJson);
/**
* 查询出库单明细
* @param whereJson /
* @return JSONArray
*/
JSONArray getOutBillDtl(JSONObject whereJson);
/**
* 查询出库单分配明细
* @param whereJson /
* @return
*/
JSONArray getOutBillDis(JSONObject whereJson);
/**
* 修改出库单
* @param whereJson /
*/
void update(JSONObject whereJson);
/**
* 全部分配,对同一出库单明细进行分配
* @param whereJson /
*/
void allDiv(JSONObject whereJson);
/**
* 分配一条出库明细
* @param whereJson /
*/
void allDivOne(JSONObject whereJson);
/**
* 全部取消
* @param whereJson /
*/
void allCancel(JSONObject whereJson);
/**
* 取消一个
* @param whereJson /
*/
void oneCancel(JSONObject whereJson);
/**
* 设置全部站点
* @param whereJson /
*/
void allSetPoint(JSONObject whereJson);
/**
* 出库单手动分配
* @param whereJson /
*/
void manualDiv(JSONObject whereJson);
/**
* 出库单强制确认
* @param whereJson /
*/
void confirm(JSONObject whereJson);
/**
* 出库任务手动完成
* @param whereJson /
*/
void finishTask(JSONObject whereJson);
/**
* 出库单强制确认
* @param whereJson /
*/
void backConfirm(JSONObject whereJson);
/**
* 下载发货单Excel
* @param whereJson /
*/
void downloadExcel(HttpServletResponse response, Map whereJson) throws IOException;
}

View File

@@ -0,0 +1,296 @@
[交易说明]
交易名: 成品出库分配逻辑
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.iostorinv_id TYPEAS s_string
输入.iostorinvdtl_id TYPEAS s_string
输入.iostorinvdis_id TYPEAS s_string
输入.task_id TYPEAS s_string
输入.bill_status TYPEAS s_string
输入.unassign_flag TYPEAS s_string
输入.material_id TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.region_code TYPEAS s_string
输入.product_area TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
iosdtl.*,
ios.bill_code,
mb.material_code,
mb.material_name,
mb.material_spec,
mb.material_model
FROM
ST_IVT_IOStorInvDtl iosdtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = iosdtl.material_id
LEFT JOIN ST_IVT_IOStorInv ios ON ios.iostorinv_id = iosdtl.iostorinv_id
WHERE
1=1
OPTION 输入.iostorinv_id <> ""
iosdtl.iostorinv_id = 输入.iostorinv_id
ENDOPTION
OPTION 输入.iostorinvdtl_id <> ""
iosdtl.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
OPTION 输入.bill_status <> ""
iosdtl.bill_status <= 输入.bill_status
ENDOPTION
OPTION 输入.unassign_flag <> ""
iosdtl.unassign_qty >0
ENDOPTION
order by iosdtl.pcsn
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
ivt.*,
region.region_code,
region.region_name,
point.vehicle_code,
mater.material_code,
mater.material_name,
mater.material_spec,
mater.material_model
FROM
st_ivt_structivt ivt
LEFT JOIN md_me_materialbase mater ON mater.material_id = ivt.material_id
LEFT JOIN sch_base_point point ON point.point_id = ivt.struct_id
LEFT JOIN sch_base_region region ON region.region_code = point.region_code
WHERE
1=1
OPTION 输入.material_id <> ""
ivt.material_id = 输入.material_id
ENDOPTION
OPTION 输入.pcsn <> ""
ivt.pcsn = 输入.pcsn
ENDOPTION
OPTION 输入.region_code <> ""
point.region_code = 输入.region_code
ENDOPTION
OPTION 输入.product_area <> ""
point.product_area = 输入.product_area
ENDOPTION
order by ivt.instorage_time DESC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
dis.*,
ios.io_type,
ios.bill_code,
mb.material_code,
mb.material_name,
task.task_code,
task.task_status,
task.task_type,
point2.point_code
FROM
ST_IVT_IOStorInvDis dis
LEFT JOIN ST_IVT_IOStorInv ios ON ios.iostorinv_id = dis.iostorinv_id
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
LEFT JOIN SCH_BASE_Task task ON task.task_id = dis.task_id AND task.is_delete = '0'
LEFT JOIN SCH_BASE_Point point2 ON point2.point_id = dis.point_id
WHERE
1=1
OPTION 输入.iostorinvdtl_id <> ""
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
OPTION 输入.task_id <> ""
dis.task_id = 输入.task_id
ENDOPTION
OPTION 输入.iostorinv_id <> ""
dis.iostorinv_id = 输入.iostorinv_id
ENDOPTION
OPTION 输入.iostorinvdis_id <> ""
dis.iostorinvdis_id = 输入.iostorinvdis_id
ENDOPTION
OPTION 输入.bill_status <> ""
dis.work_status <= 输入.bill_status
ENDOPTION
order by dis.pcsn
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
dis.iostorinvdis_id
FROM
ST_IVT_IOStorInvDis dis
WHERE
1 = 1
AND dis.work_status IN ('02', '99')
OPTION 输入.iostorinvdtl_id <> ""
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
UNION
SELECT
dis.iostorinvdis_id
FROM
ST_IVT_IOStorInvDis dis
LEFT JOIN SCH_BASE_Task task ON dis.task_id = task.task_id AND task.is_delete = '0'
WHERE
1 = 1
AND dis.work_status = '01'
AND task.task_status IN ('5', '6', '7')
OPTION 输入.iostorinvdtl_id <> ""
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "5"
QUERY
SELECT
dis.*
FROM
ST_IVT_IOStorInvDis dis
WHERE
dis.work_status = '00'
OPTION 输入.iostorinv_id <> ""
dis.iostorinv_id = 输入.iostorinv_id
ENDOPTION
OPTION 输入.iostorinvdtl_id <> ""
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "6"
QUERY
SELECT
iosdtl.*,
ios.bill_code,
mb.material_code,
mb.material_name,
mb.material_spec,
mb.material_model
FROM
ST_IVT_IOStorInvDtl iosdtl
LEFT JOIN md_me_materialbase mb ON mb.material_id = iosdtl.material_id
LEFT JOIN ST_IVT_IOStorInv ios ON ios.iostorinv_id = iosdtl.iostorinv_id
WHERE
1=1
OPTION 输入.iostorinv_id <> ""
iosdtl.iostorinv_id = 输入.iostorinv_id
ENDOPTION
OPTION 输入.iostorinvdtl_id <> ""
iosdtl.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
OPTION 输入.bill_status <> ""
iosdtl.bill_status <= 输入.bill_status
ENDOPTION
OPTION 输入.unassign_flag <> ""
iosdtl.unassign_qty >0
ENDOPTION
order by iosdtl.pcsn
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "7"
QUERY
SELECT
dis.*,
mb.material_code,
mb.material_name,
mb.material_spec,
task.task_code,
task.task_status,
task.task_type,
point_code
FROM
st_ivt_iostorinvdis dis
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dis.iostorinv_id
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id AND task.is_delete = '0'
LEFT JOIN sch_base_point point ON point.point_id = dis.point_id
WHERE
mst.is_delete = '0'
OPTION 输入.iostorinv_id <> ""
dis.iostorinv_id = 输入.iostorinv_id
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -0,0 +1,191 @@
[交易说明]
交易名: 成品出库分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.product_area TYPEAS s_string
输入.pcsn TYPEAS s_string
输入.material_spec TYPEAS s_string
输入.material_code TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.bill_status TYPEAS s_string
输入.bill_type TYPEAS s_string
输入.bill_code TYPEAS s_string
输入.iostorinvdtl_id TYPEAS s_string
输入.iostorinv_id TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
*
FROM
ST_IVT_IOStorInv
WHERE
io_type = '1'
AND is_delete = '0'
OPTION 输入.product_area <> ""
product_code = 输入.product_area
ENDOPTION
OPTION 输入.begin_time <> ""
input_time <= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
input_time >= 输入.end_time
ENDOPTION
OPTION 输入.bill_status <> ""
bill_status = 输入.bill_status
ENDOPTION
OPTION 输入.bill_type <> ""
bill_type = 输入.bill_type
ENDOPTION
OPTION 输入.bill_code <> ""
bill_code LIKE 输入.bill_code
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
dtl.*,
mater.material_code,
mater.material_name,
mater.material_spec
FROM
ST_IVT_IOStorInvDtl dtl
LEFT JOIN ST_IVT_IOStorInv mst ON mst.iostorinv_id = dtl.iostorinv_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = dtl.material_id
WHERE
mst.io_type = '1'
AND mst.is_delete = '0'
OPTION 输入.bill_code <> ""
mst.bill_code = 输入.bill_code
ENDOPTION
OPTION 输入.iostorinv_id <> ""
mst.iostorinv_id = 输入.iostorinv_id
ENDOPTION
order by dtl.seq_no ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
dis.*,
mater.material_code,
mater.material_name,
mater.material_spec,
point.point_code,
LEFT(task.task_code,6) AS task_code
FROM
ST_IVT_IOStorInvDis dis
LEFT JOIN sch_base_point point ON point.point_id = dis.point_id
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
LEFT JOIN sch_base_task task ON task.task_id = dis.task_id AND task.is_delete = '0'
WHERE
1 = 1
OPTION 输入.iostorinvdtl_id <> ""
dis.iostorinvdtl_id = 输入.iostorinvdtl_id
ENDOPTION
order by dis.seq_no ASC
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
PAGEQUERY
SELECT
ivt.struct_id,
ivt.struct_code,
ivt.struct_name,
ivt.material_id,
ivt.quality_scode,
ivt.pcsn,
ivt.canuse_qty AS plan_qty,
ivt.qty_unit_id,
ivt.instorage_time,
mater.material_code,
mater.material_name,
mater.material_spec,
unit.unit_name AS qty_unit_name
FROM
st_ivt_structivt ivt
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
LEFT JOIN sch_base_point point ON point.point_id = ivt.struct_id
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
WHERE
ivt.canuse_qty > 0
AND point.lock_type = '1'
AND IFNULL(point.vehicle_code,'') <> ''
OPTION 输入.product_area <> ""
point.product_area = 输入.product_area
ENDOPTION
OPTION 输入.material_spec <> ""
mater.material_spec LIKE 输入.material_spec
ENDOPTION
OPTION 输入.material_code <> ""
(mater.material_code LIKE 输入.material_code or
mater.material_code LIKE 输入.material_name)
ENDOPTION
OPTION 输入.pcsn <> ""
ivt.pcsn = 输入.pcsn
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,387 @@
<template>
<el-dialog
title="出库单编辑"
append-to-body
fullscreen
:before-close="crud.cancelCU"
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
@open="open"
@close="close"
>
<el-row v-show="crud.status.cu > 0" :gutter="20">
<el-col :span="20" style="border: 1px solid white">
<span />
</el-col>
<el-col :span="4">
<span>
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary" @click="crud.submitCU">保存</el-button>
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
</span>
</el-col>
</el-row>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
<el-form-item label="单据号" prop="bill_code">
<label slot="label">单&nbsp;&nbsp;据&nbsp;号:</label>
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
</el-form-item>
<el-form-item label="生产区域" prop="product_code">
<label slot="label">生产区域:</label>
<el-select
v-model="form.product_code"
clearable
placeholder="生产区域"
class="filter-item"
style="width: 210px"
:disabled="crud.status.view > 0"
@change="storChange"
>
<el-option
v-for="item in dict.product_area"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="业务类型" prop="bill_type">
<el-select
v-model="form.bill_type"
clearable
filterable
size="mini"
placeholder="业务类型"
class="filter-item"
>
<el-option
v-for="item in dict.ST_INV_OUT_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单据状态" prop="bill_status">
<el-select
v-model="form.bill_status"
clearable
style="width: 210px"
placeholder="单据状态"
class="filter-item"
disabled
>
<el-option
v-for="item in dict.IO_BILL_STATUS"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
<el-input v-model="form.detail_count" size="mini" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="总重量" prop="total_qty">
<label slot="label">总&nbsp;&nbsp;重&nbsp;量:</label>
<el-input-number
v-model="form.total_qty"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="业务日期" prop="biz_date">
<el-date-picker v-model="form.biz_date" type="date" placeholder="选择日期" style="width: 210px" value-format="yyyy-MM-dd" :disabled="crud.status.view > 0" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
</el-form-item>
</el-form>
<div class="crud-opts2">
<span class="role-span">出库明细</span>
<span v-if="crud.status.cu > 0" class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="queryDtl()"
>
添加物料
</el-button>
<!-- <el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="insertdtl()"
>
新增一行
</el-button>-->
</span>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="form.tableData"
style="width: 100%;"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" width="190" align="center">
<!-- <template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.material_code" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-search" @click="queryMater(scope.$index, scope.row)" />
</el-input>
<span v-show="scope.row.edit">{{ scope.row.material_code }}</span>
</template>-->
</el-table-column>
<el-table-column prop="material_name" label="物料名称" align="center" min-width="150px" show-overflow-tooltip />
<el-table-column prop="material_spec" label="物料规格" align="center" min-width="150px" show-overflow-tooltip />
<el-table-column show-overflow-tooltip prop="pcsn" label="订单号" width="150px" align="center">
<!-- <template scope="scope">
<el-input v-show="!scope.row.edit" v-model="scope.row.pcsn" size="mini" />
<span v-show="scope.row.edit">{{ scope.row.pcsn }}</span>
</template>-->
</el-table-column>
<el-table-column prop="plan_qty" label="出库重量" width="150" align="center">
<template scope="scope">
<el-input-number v-model="scope.row.plan_qty" :precision="3" :controls="false" :min="1" style="width: 120px" />
<!-- <span v-show="scope.row.edit">{{ scope.row.plan_qty }}</span>-->
</template>
</el-table-column>
<el-table-column prop="qty_unit_name" label="单位" align="center" />
<!-- <el-table-column show-overflow-tooltip prop="remark" label="明细备注" align="center">
<template scope="scope">
<el-input v-model="scope.row.remark" size="mini" />
<span>{{ scope.row.remark }}</span>
</template>
</el-table-column>-->
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="160" fixed="right">
<template scope="scope">
<el-button type="danger" class="filter-item" size="mini" icon="el-icon-delete" @click.native.prevent="deleteRow(scope.$index, form.tableData)" />
</template>
</el-table-column>
</el-table>
<AddDtl :dialog-show.sync="dtlShow" :stor-id="storId" @tableChanged="tableChanged5" />
<MaterDialog :dialog-show.sync="materShow" :mater-opt-code.sync="materType" @setMaterValue="setMaterValue" />
</el-dialog>
</template>
<script>
import CRUD, { crud, form } from '@crud/crud'
import AddDtl from '@/views/wms/st/productOut/AddDtl'
import MaterDialog from '@/views/wms/pub/MaterDialog'
import productOut from '@/views/wms/st/productOut/productout'
import crudProductIn from '@/views/wms/st/productIn/productin'
const defaultForm = {
bill_code: '',
stor_id: '',
stor_code: '',
stor_name: '',
bill_status: '10',
total_qty: '0',
detail_count: '0',
bill_type: '',
remark: '',
biz_date: new Date(),
out_stor_id: '',
create_mode: '',
tableData: []
}
export default {
name: 'AddDialog',
components: { AddDtl, MaterDialog },
mixins: [crud(), form(defaultForm)],
props: {
dialogShow: {
type: Boolean,
default: false
}
},
dicts: ['IO_BILL_STATUS', 'ST_INV_OUT_TYPE', 'product_area'],
data() {
return {
dialogVisible: false,
dtlShow: false,
materType: '',
materShow: false,
flagnow: false,
nowrow: {},
nowindex: '',
storlist: [],
inStorList: [],
invtypelist: [],
storId: null,
rules: {
product_code: [
{ required: true, message: '生产区域不能为空', trigger: 'blur' }
],
bill_type: [
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
],
biz_date: [
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
]
}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
methods: {
open() {
crudProductIn.queryStor().then(res => {
this.storlist = res
})
},
close() {
this.$emit('AddChanged')
},
[CRUD.HOOK.beforeSubmit]() {
if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
},
[CRUD.HOOK.afterToEdit]() {
productOut.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
/* for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.edit = false
this.form.tableData.splice(i, 1, row)
}*/
})
},
[CRUD.HOOK.afterToView]() {
productOut.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
this.form.tableData = res
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
row.edit = true
this.form.tableData.splice(i, 1, row)
}
})
},
invtypeFormat(row, column) {
return this.dict.label.ST_INV_OUT_TYPE[row.source_bill_type]
},
storChange(row) {
this.storlist.forEach((item) => {
if (item.product_code === row) {
this.form.product_code = item.product_code
}
})
},
async queryMater(index, row) {
if (this.form.bill_type === '') {
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.materShow = true
this.nowindex = index
this.nowrow = row
},
queryDtl(index, row) {
if (this.form.bill_type === '') {
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.form.product_code === '') {
this.crud.notify('请选择生产区域!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.storId = this.form.product_code
this.dtlShow = true
},
tableChanged5(rows) {
rows.forEach((item) => {
debugger
if (this.form.tableData.length !== 0) {
this.flagnow = false
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].material_id === item.material_id && this.form.tableData[i].pcsn === item.pcsn) {
this.flagnow = true
}
}
if (!this.flagnow) {
item.edit = true
this.form.tableData.splice(-1, 0, item)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
}
} else {
item.edit = true
this.form.tableData.splice(-1, 0, item)
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
}
})
this.form.detail_count = this.form.tableData.length
},
setMaterValue(row) {
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].material_id === row.material_id) {
this.crud.notify('不允许添加相同物料!')
return false
}
}
this.nowrow.material_id = row.material_id
this.nowrow.material_code = row.material_code
this.nowrow.material_name = row.material_name
this.nowrow.qty_unit_id = row.base_unit_id
this.nowrow.qty_unit_name = row.unit_name
this.nowrow.plan_qty = '1'
this.nowrow.edit = false
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
},
async insertdtl() {
if (this.form.bill_type === '') {
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.form.tableData.push({ material_id: '', material_code: '', material_name: '', pcsn: '', quality_scode: '00', plan_qty: '1', qty_unit_name: '', qty_unit_id: '', remark: '', edit: false })
this.form.detail_count = this.form.tableData.length
},
deleteRow(index, rows) {
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
rows.splice(index, 1)
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
padding: 4px 4px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -0,0 +1,163 @@
<template>
<el-dialog
title="物料选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
width="1000px"
@close="close"
@open="open"
>
<div class="head-container">
<div>
<!-- 搜索 -->
<el-input
v-model="query.material_code"
clearable
size="mini"
placeholder="物料编码、名称"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input
v-model="query.material_spec"
clearable
size="mini"
placeholder="物料规格"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-input
v-model="query.pcsn"
clearable
size="mini"
placeholder="订单号"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<rrOperation />
</div>
</div>
<!--表格渲染-->
<el-table
ref="multipleTable"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="instorage_time" label="入库日期" :min-width="flexWidth('instorage_time',crud.data,'入库日期')" />
<el-table-column prop="material_code" label="物料编码" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="material_spec" label="物料规格" :min-width="flexWidth('material_name',crud.data,'物料规格')" />
<el-table-column prop="struct_code" label="点位" :min-width="flexWidth('struct_name',crud.data,'点位')" />
<el-table-column prop="pcsn" label="订单号" :min-width="flexWidth('pcsn',crud.data,'订单号')" />
<el-table-column show-overflow-tooltip prop="plan_qty" :formatter="crud.formatNum3" label="可用数" />
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="重量单位" />
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
export default {
name: 'AddDtl',
components: { rrOperation, pagination },
cruds() {
return CRUD({
title: '用户', url: 'api/productOut/addDtl',
optShow: {
add: false,
edit: false,
del: false,
reset: true,
download: false
},
query: {
}
})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
openParam: {
type: String
},
storId: {
type: String
}
},
data() {
return {
dialogVisible: false,
opendtlParam: '',
rows: [],
openShow: true
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openParam: {
handler(newValue, oldValue) {
this.opendtlParam = newValue
}
}
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
this.crud.query.mater_type = this.opendtlParam
this.crud.query.stor_id = this.storId
if (this.openShow) {
this.openShow = false
return false
} else {
return true
}
},
close() {
this.crud.resetQuery(false)
// 清空grid数据
this.crud.data = undefined
this.$emit('update:dialogShow', false)
},
open() {
this.crud.query.mater_type = this.opendtlParam
},
submit() {
this.rows = this.$refs.multipleTable.selection
if (this.rows.length <= 0) {
this.$message('请先勾选物料')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
}
}
}
</script>

View File

@@ -0,0 +1,580 @@
<template>
<el-dialog
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
fullscreen
@close="close"
@open="open"
>
<span slot="title" class="dialog-footer">
<div class="crud-opts2">
<span class="el-dialog__title2">出库分配</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
</span>
</div>
</span>
<div class="crud-opts2">
<span class="role-span">出库明细</span>
<div class="crud-opts-form">
<el-form ref="form" :inline="true" :model="form" size="mini">
<el-form-item label="生产区域" prop="gender2">
<el-cascader
placeholder="请选择"
:options="sects"
:props="{ checkStrictly: true }"
clearable
@change="sectQueryChange"
/>
</el-form-item>
</el-form>
</div>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button
slot="left"
class="filter-item"
:loading="loadingAlldiv"
type="primary"
icon="el-icon-plus"
size="mini"
@click="allDiv()"
>
全部分配
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
@click="allCancel()"
>
全部取消
</el-button>
<el-button
slot="left"
class="filter-item"
:loading="loadingAutodiv"
type="primary"
icon="el-icon-check"
size="mini"
:disabled="button1"
@click="oneDiv()"
>
自动分配
</el-button>
<el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-check"
size="mini"
:disabled="button2"
@click="oneCancel()"
>
自动取消
</el-button>
<!-- <el-button
slot="left"
class="filter-item"
type="primary"
icon="el-icon-plus"
size="mini"
:disabled="button3"
@click="openStructIvt"
>
手工分配
</el-button>-->
<el-button
slot="left"
class="filter-item"
type="warning"
:loading="loadingSetAllPoint"
icon="el-icon-check"
size="mini"
@click="allSetPointAllDtl"
>
一键设置
</el-button>
</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
max-height="300"
border
:cell-style="cellStyle"
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleDtlCurrentChange"
>
<el-table-column prop="bill_status" label="状态" align="center" width="110px" :formatter="bill_statusFormat" />
<el-table-column show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column show-overflow-tooltip prop="material_spec" label="物料规格" align="center" />
<el-table-column show-overflow-tooltip prop="pcsn" label="订单号" align="center" width="140px" />
<el-table-column show-overflow-tooltip prop="plan_qty" label="重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="assign_qty" label="已分配重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="unassign_qty" label="未分配重量" :formatter="crud.formatNum3" align="center" />
</el-table>
</el-card>
<div class="crud-opts2">
<span class="role-span">分配明细</span>
<div class="crud-opts-form">
<el-form ref="form2" :inline="true" :model="form2" size="mini">
<el-form-item label="待分配" prop="unassign_qty">
<el-input-number
v-model="form2.unassign_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="已分配" prop="assign_qty">
<el-input-number
v-model="form2.assign_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="出库点" prop="point_code">
<el-select
v-model="form2.point_code"
clearable
placeholder="请选择"
class="filter-item"
style="width: 200px;"
>
<el-option
v-for="item in this.pointList"
:key="item.point_code"
:label="item.point_name"
:value="item.point_code"
/>
</el-select>
</el-form-item>
</el-form>
</div>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<!-- <el-button
slot="left"
class="filter-item"
:loading="loadingSetPoint"
type="warning"
icon="el-icon-check"
size="mini"
:disabled="button4"
@click="oneSetPoint2"
>
设置站点
</el-button>-->
<el-button
slot="left"
class="filter-item"
:loading="loadingSetAllPoint"
type="warning"
icon="el-icon-check"
:disabled="button5"
size="mini"
@click="allSetPoint"
>
一键设置
</el-button>
</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table2"
:data="tabledis"
style="width: 100%;"
max-height="400"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleDisCurrentChange"
>
<el-table-column prop="bill_status" label="状态" align="center" width="110px">
<template slot-scope="scope">
<el-select
v-model="scope.row.work_status"
class="filter-item"
:disabled="true"
>
<el-option
v-for="item in dict.work_status"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="material_code" label="物料编码" width="150px" :min-width="flexWidth('material_code',crud.data,'物料编码')" />
<el-table-column prop="material_name" label="物料名称" width="250px" :min-width="flexWidth('material_name',crud.data,'物料名称')" />
<el-table-column prop="material_spec" label="物料规格" width="150px" :min-width="flexWidth('material_spec',crud.data,'物料规格')" />
<el-table-column prop="pcsn" label="订单号" width="150px" :min-width="flexWidth('pcsn',crud.data,'订单号')" />
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" align="center" />
<el-table-column show-overflow-tooltip prop="struct_code" width="150px" label="点位编码" align="center" />
<el-table-column show-overflow-tooltip prop="struct_name" width="150px" label="点位名称" align="center" />
<el-table-column show-overflow-tooltip prop="task_code" width="150px" label="任务号" align="center" />
<el-table-column show-overflow-tooltip prop="point_code" width="150px" label="出库点" align="center" />
</el-table>
</el-card>
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl" />
</el-dialog>
</template>
<script>
import CRUD, { crud } from '@crud/crud'
import productOut from '@/views/wms/st/productOut/productout'
import StructIvt from '@/views/wms/st/productOut/StructIvt'
import crudRegion from '@/api/wms/sch/region'
import crudPoint from '@/api/wms/sch/point'
export default {
name: 'DivDialog',
components: { StructIvt },
mixins: [crud()],
dicts: ['IO_BILL_STATUS', 'work_status'],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
},
openArray: {
type: Array,
default: () => { return [] }
},
storId: {
type: String,
default: null
}
},
data() {
return {
dialogVisible: false,
loadingAlldiv: false,
loadingAutodiv: false,
loadingSetPoint: false,
loadingSetAllPoint: false,
areatype: '',
typedisable: false,
pointshow: false,
structshow: false,
button1: true,
button2: true,
button3: true,
button4: true,
button5: true,
tableDtl: [],
openParam: [],
mstrow: {},
openRow: {},
tabledis: [],
currentRow: {},
currentDis: {},
form: {
gender2: ''
},
form2: {
unassign_qty: '0',
assign_qty: '0',
point_code: ''
},
sects: [],
invtypelist: [],
pointList: [],
rules: {
}
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openArray: {
handler(newValue, oldValue) {
this.tableDtl = newValue
}
},
rowmst: {
handler(newValue, oldValue) {
this.mstrow = newValue
}
}
},
methods: {
open() {
crudRegion.getRegionSelect({ 'stor_id': this.storId }).then(res => {
this.sects = res.content
})
const area_type = 'CK01'
crudPoint.getPoint({ 'area_type': area_type }).then(res => {
this.pointList = res
})
},
close() {
this.$refs['form2'].resetFields()
this.tabledis = []
this.$emit('DivChanged')
this.$emit('update:dialogShow', false)
},
bill_statusFormat(row, column) {
return this.dict.label.IO_BILL_STATUS[row.bill_status]
},
quality_scodeFormat(row, column) {
return this.dict.label.ST_QUALITY_SCODE[row.quality_scode]
},
invtypeFormat(row, column) {
for (const item of this.invtypelist) {
if (item.code === row.source_bill_type) {
return item.name
}
}
},
openPoint() {
if (this.mstrow.bill_type === '010101') {
this.areatype = "'31'"
} else if (this.mstrow.bill_type === '010201' || this.mstrow.bill_type === '010202' || this.mstrow.bill_type === '010401') {
this.areatype = "'21'"
} else if (this.mstrow.bill_type === '010503' || this.mstrow.bill_type === '010501') {
this.areatype = "'22','23','24'"
} else if (this.mstrow.bill_type === '010502') {
this.areatype = "'21','22','23','24'"
} else if (this.mstrow.bill_type === '010801') {
this.areatype = "'22','23','24','31','35'"
} else if (this.mstrow.bill_type === '010601') {
this.areatype = ''
}
this.pointshow = true
this.$refs.child.getMsg(this.areatype)
},
PointChanged(row) {
this.form2.point_code = row.point_code
},
openStructIvt() {
this.currentRow.remark = ''
this.currentRow.stor_id = this.storId
productOut.getStructIvt(this.currentRow).then(res => {
this.openParam = res
this.structshow = true
this.openRow = this.currentRow
})
},
sectQueryChange(val) {
if (val.length === 1) {
this.mstrow.stor_id = val[0]
this.mstrow.sect_id = ''
}
if (val.length === 0) {
this.mstrow.sect_id = ''
this.mstrow.stor_id = ''
}
if (val.length === 2) {
this.mstrow.stor_id = val[0]
this.mstrow.sect_id = val[1]
}
},
tabledisabled(row) {
if ((row.work_status === '00' || row.work_status === '01') && row.is_issued === '0') {
return false
} else {
return true
}
},
deleteRow(row) {
productOut.oneCancel(row).then(res => {
this.queryTableDtl()
})
},
handleDtlCurrentChange(current) {
if (current !== null) {
this.currentRow = current
this.form2.unassign_qty = current.unassign_qty
this.form2.assign_qty = current.assign_qty
this.tabledis = []
if (current.bill_status === '10') {
this.button1 = false
this.button2 = true
this.button5 = false
this.button3 = false
} else if (current.bill_status === '20') {
this.button1 = false
this.button2 = false
this.button3 = false
this.button5 = false
} else if (current.bill_status === '30') {
this.button1 = true
this.button2 = false
this.button3 = true
this.button5 = false
}
this.queryTableDdis(current.iostorinvdtl_id)
} else {
this.button1 = true
this.button2 = true
this.button3 = true
this.button5 = true
this.mstrow.iostorinvdtl_id = ''
this.currentRow = {}
this.tabledis = []
}
},
handleDisCurrentChange(current) {
if (current !== null) {
this.currentDis = current
if (current.work_status === '01' || current.work_status === '00') {
this.button4 = false
} else {
this.button4 = true
}
} else {
this.button4 = true
this.mstrow.iostorinvdis_id = ''
this.currentDis = {}
}
},
allDiv() {
this.loadingAlldiv = true
productOut.allDiv(this.mstrow).then(res => {
this.crud.notify('分配成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.queryTableDtl()
this.loadingAlldiv = false
}).catch(() => {
this.loadingAlldiv = false
})
},
oneDiv() {
this.loadingAutodiv = true
if (this.currentRow.iostorinvdtl_id !== null) {
this.mstrow.iostorinvdtl_id = this.currentRow.iostorinvdtl_id
productOut.allDivOne(this.mstrow).then(res => {
this.queryTableDtl()
this.loadingAutodiv = false
}).catch(() => {
this.loadingAutodiv = false
})
}
},
allCancel() {
productOut.allCancel(this.mstrow).then(res => {
this.queryTableDtl()
})
},
oneCancel() {
if (this.currentRow.iostorinvdtl_id !== null) {
productOut.allCancel(this.currentRow).then(res => {
this.queryTableDtl()
})
}
},
allSetPoint() {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
if (this.currentRow === '') {
this.crud.notify('请选择明细!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.loadingSetAllPoint = true
this.currentRow.point_code = this.form2.point_code
productOut.allSetPoint(this.currentRow).then(res => {
this.queryTableDdis(this.currentRow.iostorinvdtl_id)
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.loadingSetAllPoint = false
}).catch(() => {
this.loadingSetAllPoint = false
})
},
allSetPointAllDtl() {
if (this.form2.point_code === '') {
this.crud.notify('请先选择站点!', CRUD.NOTIFICATION_TYPE.INFO)
return
}
this.loadingSetAllPoint = true
const data = {
'point_code': this.form2.point_code,
'iostorinv_id': this.mstrow.iostorinv_id
}
productOut.allSetPoint(data).then(res => {
this.crud.notify('设置成功!', CRUD.NOTIFICATION_TYPE.INFO)
this.loadingSetAllPoint = false
}).catch(() => {
this.loadingSetAllPoint = false
})
},
queryTableDtl() {
productOut.getOutBillDtl({ 'iostorinv_id': this.mstrow.iostorinv_id }).then(res => {
this.tableDtl = res
})
},
queryTableDdis(iostorinvdtl_id) {
productOut.getOutBillDis({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => {
this.tabledis = res
}).catch(() => {
this.tabledis = []
})
},
cellStyle({ row, column, rowIndex, columnIndex }) {
const assign_qty = parseFloat(row.assign_qty)
const plan_qty = parseFloat(row.plan_qty)
if (column.property === 'assign_qty') {
if (assign_qty > plan_qty) {
return 'background: yellow'
}
}
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .el-dialog__title2 {
line-height: 24px;
font-size:20px;
color:#303133;
}
.crud-opts2 .role-span {
padding: 10px 0px 10px 0px;
}
.crud-opts2 .crud-opts-form {
padding: 10px 0px 0px 20px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -0,0 +1,278 @@
<template>
<el-dialog
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
:show-close="false"
fullscreen
@close="close"
@open="open"
>
<span slot="title" class="dialog-footer">
<div class="crud-opts2">
<span class="el-dialog__title2">出库手工分配</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
</span>
</div>
</span>
<div class="crud-opts2">
<span class="role-span" style="width: 100px">可分配库存</span>
<div class="crud-opts-form">
<el-form ref="form2" :inline="true" :model="queryrow" size="mini">
<el-form-item label="待分配" prop="unassign_qty">
<el-input-number
v-model="queryrow.unassign_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="已分配" prop="assign_qty">
<el-input-number
v-model="queryrow.assign_qty"
:controls="false"
:precision="3"
:min="0"
disabled
/>
</el-form-item>
<el-form-item label="库区" prop="sect_id">
<el-cascader
placeholder="请选择"
:options="sects"
:props="{ checkStrictly: true }"
clearable
@change="sectQueryChange"
/>
</el-form-item>
<el-form-item label="关键字" prop="remark">
<el-input
v-model="queryrow.remark"
clearable
style="width: 220px"
size="mini"
placeholder="货位编码"
prefix-icon="el-icon-search"
class="filter-item"
/>
</el-form-item>
<el-form-item label="sap批次" prop="remark">
<el-input
v-model="queryrow.sap_pcsn"
clearable
style="width: 220px"
size="mini"
placeholder="sap批次"
prefix-icon="el-icon-search"
class="filter-item"
/>
</el-form-item>
<el-form-item label="子卷号" prop="remark">
<el-input
v-model="queryrow.pcsn"
clearable
style="width: 220px"
size="mini"
placeholder="子卷号"
prefix-icon="el-icon-search"
class="filter-item"
/>
</el-form-item>
<el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="queryStruct">搜索</el-button>
</el-form>
</div>
</div>
<!--表格渲染-->
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
max-height="500"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column show-overflow-tooltip prop="sect_name" label="库区" align="center" />
<el-table-column show-overflow-tooltip prop="struct_code" label="仓位" align="center" />
<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 sortable prop="sap_pcsn" label="sap批次" align="center" width="140px" />
<el-table-column show-overflow-tooltip prop="canuse_qty" label="可出重量" :formatter="crud.formatNum3" align="center" />
<!-- <el-table-column show-overflow-tooltip prop="plan_qty" label="重量" :formatter="crud.formatNum3" width="160" align="center">-->
<!-- <template scope="scope">-->
<!-- <el-input-number v-show="!scope.row.edit" v-model="scope.row.plan_qty" :precision="3" :max="100000000" />-->
<!-- <span v-show="scope.row.edit">{{ scope.row.plan_qty }}</span>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column show-overflow-tooltip prop="qty_unit_name" label="单位" align="center" />-->
<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>
<el-button v-show="scope.row.edit" type="success" class="filter-item" size="mini" icon="el-icon-check" @click="handleEdit(scope.$index, scope.row)">完成</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import CRUD, { header } from '@crud/crud'
// import crudSectattr from '@/views/wms/basedata/st/sect/sectattr'
import productOut from '@/views/wms/st/productOut/productout'
// import crudUserStor from '@/views/wms/basedata/st/userStor/userStor'
export default {
name: 'StructIvt',
components: { },
mixins: [header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
},
openArray: {
type: Array,
default: () => { return [] }
},
storId: {
type: String,
default: null
}
},
data() {
return {
dialogVisible: false,
dialogVisible2: false,
goal_unassign_qty: 0,
queryrow: {},
sects: [],
tableDtl: []
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
this.dialogVisible = newValue
}
},
openArray: {
handler(newValue, oldValue) {
this.tableDtl = newValue
}
},
rowmst: {
handler(newValue, oldValue) {
this.queryrow = newValue
this.goal_unassign_qty = JSON.parse(JSON.stringify(this.queryrow.unassign_qty))
}
}
},
methods: {
open() {
/* crudUserStor.getSect({ 'stor_id': this.storId }).then(res => {
this.sects = res.content
})*/
this.query.source_bill_code = this.queryrow.source_bill_code
this.query.material_id = this.queryrow.material_id
},
queryStruct() {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(this.queryrow.assign_qty)
this.queryrow.assign_qty = 0
/* productOut.getStructIvt(this.queryrow).then(res => {
this.tableDtl = res
})*/
},
sectQueryChange(val) {
if (val.length === 1) {
this.queryrow.stor_id = val[0]
this.queryrow.sect_id = ''
}
if (val.length === 0) {
this.queryrow.sect_id = ''
this.queryrow.stor_id = ''
}
if (val.length === 2) {
this.queryrow.stor_id = val[0]
this.queryrow.sect_id = val[1]
}
},
handleEdit(index, row) {
// 判断是否可以关闭编辑状态
if (row.edit === undefined) {
this.$set(row, 'edit', false)
}
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)
} else {
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - parseFloat(row.canuse_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)
}
if (this.queryrow.unassign_qty > this.goal_unassign_qty) {
this.queryrow.unassign_qty = JSON.parse(JSON.stringify(this.goal_unassign_qty))
}
// 如果已分配汇总量 > 明细重量 则待分配重量为0
if (this.queryrow.assign_qty > this.goal_unassign_qty) {
this.queryrow.unassign_qty = parseFloat('0')
}
}
this.tableDtl.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
},
close() {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
},
submit() {
if (parseFloat(this.queryrow.assign_qty) === 0) {
this.crud.notify('请分配后再提交', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
if (parseFloat(this.queryrow.unassign_qty) === 0) {
const rows = []
this.tableDtl.forEach((item) => {
if (item.edit) {
rows.push(item)
}
})
productOut.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
})
} else {
this.$confirm('未分配重量不为0,是否继续提交?')
.then(_ => {
const rows = []
this.tableDtl.forEach((item) => {
if (item.edit) {
rows.push(item)
}
})
productOut.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
this.$emit('update:dialogShow', false)
this.$emit('StructIvtClosed')
})
})
.catch(_ => {
})
}
}
}
}
</script>

View File

@@ -0,0 +1,283 @@
<template>
<el-dialog
append-to-body
title="出库单详情"
:visible.sync="dialogVisible"
destroy-on-close
fullscreen
@close="close"
@open="open"
>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="85px" label-suffix=":">
<el-form-item label="单据号" prop="bill_code">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px" />
</el-form-item>
<el-form-item label="生产区域">
<el-select
v-model="form.product_code"
clearable
size="mini"
placeholder="全部"
:disabled="true"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.product_area"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="业务类型" prop="bill_type">
<el-select
v-model="form.bill_type"
clearable
filterable
size="mini"
placeholder="业务类型"
class="filter-item"
disabled
>
<el-option
v-for="item in dict.ST_INV_OUT_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单据状态" prop="bill_status">
<el-select
v-model="form.bill_status"
clearable
style="width: 210px"
placeholder="单据状态"
class="filter-item"
disabled
>
<el-option
v-for="item in dict.io_bill_status"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.detail_count" size="mini" disabled style="width: 210px" />
</el-form-item>
<el-form-item label="总重量" prop="total_qty">
<label slot="label">&nbsp;&nbsp;&nbsp;:</label>
<el-input-number
v-model="form.total_qty"
:controls="false"
:precision="3"
:min="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="业务日期" prop="biz_date">
<el-date-picker v-model="form.biz_date" type="date" placeholder="选择日期" style="width: 210px" value-format="yyyy-MM-dd" :disabled="true" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="true" />
</el-form-item>
</el-form>
<div class="crud-opts2">
<span class="role-span2">出库明细</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table"
:data="tableDtl"
style="width: 100%;"
max-height="300"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleDtlCurrentChange"
>
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column :formatter="bill_statusFormat" prop="bill_status" label="状态" />
<el-table-column min-width="140" show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="material_spec" label="物料规格" align="center" />
<el-table-column prop="pcsn" label="订单号" width="150px" align="center" show-overflow-tooltip />
<el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="重量" align="center" />
<el-table-column prop="assign_qty" :formatter="crud.formatNum3" label="已分配重量" align="center" width="100px" />
<el-table-column prop="unassign_qty" :formatter="crud.formatNum3" label="未分配重量" align="center" width="100px" />
<el-table-column prop="qty_unit_name" label="单位" align="center" />
<el-table-column show-overflow-tooltip prop="remark" label="明细备注" align="center" />
</el-table>
</el-card>
<div class="crud-opts2">
<span class="role-span">作业明细</span>
</div>
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
<!--表格渲染-->
<el-table
ref="table2"
:data="tabledis"
style="width: 100%;"
max-height="300"
size="mini"
border
:highlight-current-row="true"
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@current-change="handleDisCurrentChange"
>
<el-table-column min-width="120" show-overflow-tooltip prop="material_code" label="物料编码" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
<el-table-column min-width="120" show-overflow-tooltip prop="material_spec" label="物料规格" align="center" />
<el-table-column prop="pcsn" label="订单号" align="center" show-overflow-tooltip />
<el-table-column prop="plan_qty" :formatter="crud.formatNum3" label="重量" align="center" />
<el-table-column prop="struct_code" label="仓位" align="center" show-overflow-tooltip />
<el-table-column prop="region_code" label="区域" align="center" show-overflow-tooltip />
<el-table-column prop="task_status" label="状态" align="center" width="110px" :formatter="task_statusFormat" />
</el-table>
</el-card>
</el-dialog>
</template>
<script>
import { crud } from '@crud/crud'
import productOut from '@/views/wms/st/productOut/productout'
// import crudStorattr from '@/views/wms/basedata/st/stor/storattr'
// import crudRawAssist from '@/views/wms/st/inbill/rawassist'
import crudProductIn from '@/views/wms/st/productIn/productin'
export default {
name: 'ViewDialog',
components: { },
mixins: [crud()],
dicts: ['io_bill_status', 'work_status', 'task_status', 'SCH_TASK_TYPE_DTL', 'ST_INV_OUT_TYPE', 'product_area'],
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
}
},
data() {
return {
dialogVisible: false,
tableDtl: [],
tabledis: [],
storlist: [],
currentdtl: null,
currentDis: {},
form: {}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
},
rowmst: {
handler(newValue) {
this.form = newValue
}
}
},
created() {
crudProductIn.queryStor().then(res => {
this.storlist = res
})
},
methods: {
open() {
this.queryTableDtl()
},
close() {
this.$emit('update:dialogShow', false)
this.currentDis = {}
this.currentdtl = null
this.tableDtl = []
this.tabledis = []
this.$emit('AddChanged')
},
bill_statusFormat(row) {
return this.dict.label.io_bill_status[row.bill_status]
},
taskdtl_typeFormat(row) {
return this.dict.label.SCH_TASK_TYPE_DTL[row.taskdtl_type]
},
task_statusFormat(row) {
return this.dict.label.task_status[row.task_status]
},
work_statusFormat(row) {
return this.dict.label.work_status[row.work_status]
},
handleDtlCurrentChange(current) {
if (current !== null) {
this.tabledis = []
this.currentdtl = current
this.queryTableDdis()
} else {
this.tabledis = []
this.currentdtl = {}
}
},
invtypeFormat(row, column) {
for (const item of this.billtypelist) {
if (item.code === row.source_bill_type) {
return item.name
}
}
},
handleDisCurrentChange(current) {
this.currentDis = current
},
queryTableDtl() {
productOut.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
this.tableDtl = res
})
},
queryTableDdis() {
if (this.currentdtl !== null) {
productOut.getOutBillDis({ 'iostorinvdtl_id': this.currentdtl.iostorinvdtl_id }).then(res => {
this.tabledis = res
}).catch(() => {
this.tabledis = []
})
}
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .el-dialog__title2 {
line-height: 24px;
font-size:20px;
color:#303133;
}
.crud-opts2 .role-span2 {
padding: 0px 0px 20px 0px;
}
.crud-opts2 {
padding: 10px 0px 0px 50px;
}
</style>

View File

@@ -0,0 +1,325 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="模糊查询">
<el-input
v-model="query.bill_code"
size="mini"
clearable
placeholder="单据号"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="生产区域">
<el-select
v-model="query.product_code"
clearable
size="mini"
placeholder="全部"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.product_area"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="单据状态">
<el-select
v-model="query.bill_status"
clearable
size="mini"
placeholder="单据状态"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.IO_BILL_STATUS"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="业务类型">
<el-select
v-model="query.bill_type"
clearable
filterable
size="mini"
placeholder="业务类型"
class="filter-item"
@change="crud.toQuery"
>
<el-option
v-for="item in dict.ST_INV_OUT_TYPE"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker
v-model="query.createTime"
type="daterange"
value-format="yyyy-MM-dd HH:mm:ss"
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
slot="right"
class="filter-item"
type="success"
icon="el-icon-position"
size="mini"
:disabled="dis_flag"
@click="divOpen"
>
分配
</el-button>
<el-button
slot="right"
class="filter-item"
:loading="loadingConfirm"
type="warning"
:disabled="confirm_flag"
icon="el-icon-check"
size="mini"
@click="confirm"
>
强制确认
</el-button>
</crudOperation>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
size="mini"
:data="crud.data"
style="width: 100%;"
:highlight-current-row="true"
@selection-change="crud.selectionChangeHandler"
@current-change="handleCurrentChange"
@select="handleSelectionChange"
@select-all="onSelectAll"
>
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:disabled-edit="canUd(scope.row)"
:disabled-dle="canUd(scope.row)"
/>
</template>
</el-table-column>
<el-table-column :selectable="checkboxT" type="selection" width="55" />
<el-table-column show-overflow-tooltip prop="bill_code" width="130" label="单据号">
<template slot-scope="scope">
<el-link type="warning" @click="toView(scope.$index, scope.row)">{{ scope.row.bill_code }}</el-link>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip :formatter="stateFormat" width="80" prop="bill_status" label="单据状态" />
<el-table-column show-overflow-tooltip prop="product_code" label="生产区域" width="80" />
<el-table-column show-overflow-tooltip prop="bill_type" :formatter="bill_typeFormat" label="业务类型" />
<el-table-column show-overflow-tooltip width="100" prop="biz_date" label="业务日期" />
<el-table-column show-overflow-tooltip label="明细数" align="center" prop="detail_count" width="60" />
<el-table-column show-overflow-tooltip label="总重量" align="center" prop="total_qty" width="100" />
<el-table-column show-overflow-tooltip label="备注" align="center" prop="remark" width="100" />
<el-table-column show-overflow-tooltip label="制单人" align="center" prop="input_optname" />
<el-table-column show-overflow-tooltip label="制单时间" align="center" prop="input_time" width="140" />
<el-table-column show-overflow-tooltip label="修改人" align="center" prop="update_optname" />
<el-table-column show-overflow-tooltip label="修改时间" align="center" prop="update_time" width="140" />
<el-table-column show-overflow-tooltip label="分配人" align="center" prop="dis_optname" />
<el-table-column show-overflow-tooltip label="分配时间" align="center" prop="dis_time" width="140" />
<el-table-column show-overflow-tooltip label="确认人" align="center" prop="confirm_optname" />
<el-table-column show-overflow-tooltip label="确认时间" align="center" prop="confirm_time" width="140" />
</el-table>
<!--分页组件-->
<pagination />
</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" />
</div>
</template>
<script>
import productOut from '@/views/wms/st/productOut/productout'
import CRUD, { crud, header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import AddDialog from '@/views/wms/st/productOut/AddDialog'
import DivDialog from '@/views/wms/st/productOut/DivDialog'
import ViewDialog from '@/views/wms/st/productOut/ViewDialog'
import crudProductIn from '@/views/wms/st/productIn/productin'
export default {
name: 'ProductOut',
components: { ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DivDialog },
cruds() {
return CRUD({ title: '用户', idField: 'iostorinv_id', url: 'api/productOut', crudMethod: { ...productOut },
optShow: {
add: true,
edit: false,
del: false,
reset: true,
download: false
}})
},
mixins: [presenter(), header(), crud()],
// 数据字典
dicts: ['IO_BILL_STATUS', 'ST_INV_OUT_TYPE', 'product_area'],
data() {
return {
height: document.documentElement.clientHeight - 180 + 'px;',
permission: {
add: ['admin', 'checkoutbill:add'],
edit: ['admin', 'checkoutbill:edit'],
del: ['admin', 'checkoutbill:del']
},
openMoneyDialog: false,
loadingConfirm: false,
divShow: false,
taskShow: false,
dis_flag: true,
work_flag: true,
confirm_flag: true,
openParam: [],
openParamMoney: null,
mstrow: {},
viewShow: false,
currentRow: null,
checkrows: [],
billtypelist: [],
storlist: [],
storId: null
}
},
mounted: function() {
const that = this
window.onresize = function temp() {
that.height = document.documentElement.clientHeight - 180 + 'px;'
}
},
created() {
crudProductIn.queryStor().then(res => {
this.storlist = res
})
},
methods: {
canUd(row) {
return row.bill_status !== '10'
},
toView(index, row) {
this.mstrow = row
this.viewShow = true
},
[CRUD.HOOK.beforeRefresh]() {
this.handleCurrentChange(null)
},
handleSelectionChange(val, row) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
this.buttonChange(row)
} else if (val.length === 1) {
this.buttonChange(row)
} else {
this.handleCurrentChange(null)
}
},
onSelectAll() {
this.$refs.table.clearSelection()
this.handleCurrentChange(null)
},
buttonChange(current) {
if (current !== null) {
this.currentRow = current
if (current.bill_status === '10' || current.bill_status === '20' || current.bill_status === '30') {
this.dis_flag = false
} else {
this.dis_flag = true
}
if (current.bill_status === '30') {
this.confirm_flag = false
} else {
this.confirm_flag = true
}
}
},
stateFormat(row, column) {
return this.dict.label.IO_BILL_STATUS[row.bill_status]
},
bill_typeFormat(row) {
return this.dict.label.ST_INV_OUT_TYPE[row.bill_type]
},
handleCurrentChange(current) {
if (current === null) {
this.dis_flag = true
this.confirm_flag = true
this.work_flag = true
this.currentRow = {}
}
},
checkboxT(row) {
return row.bill_status !== '99'
},
divOpen() {
productOut.getOutBillDtl({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
debugger
this.openParam = res
this.storId = this.currentRow.product_code
this.divShow = true
this.mstrow = this.currentRow
})
},
confirm() {
this.loadingConfirm = true
productOut.confirm({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
this.querytable()
this.crud.notify('出库成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.loadingConfirm = false
}).catch(() => {
this.loadingConfirm = false
})
},
querytable() {
this.onSelectAll()
this.crud.toQuery()
this.handleCurrentChange(null)
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 10px;
}
</style>

View File

@@ -0,0 +1,228 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/productOut',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/productOut/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/productOut',
method: 'put',
data
})
}
export function getOutBillDtl(data) {
return request({
url: '/api/productOut/getOutBillDtl',
method: 'post',
data
})
}
export function getOutBillDis(data) {
return request({
url: '/api/productOut/getOutBillDis',
method: 'post',
data
})
}
export function getOutBillDisDtl(params) {
return request({
url: '/api/productOut/getOutBillDisDtl',
method: 'get',
params
})
}
export function getOutBillTask(params) {
return request({
url: '/api/productOut/getOutBillTask',
method: 'get',
params
})
}
export function getInvTypes() {
return request({
url: '/api/productOut/getInvTypes',
method: 'get'
})
}
export function insertDtl(data) {
return request({
url: '/api/productOut/insertDtl',
method: 'post',
data
})
}
export function allDiv(data) {
return request({
url: '/api/productOut/allDiv',
method: 'post',
data
})
}
export function allDivOne(data) {
return request({
url: '/api/productOut/allDivOne',
method: 'post',
data
})
}
export function allCancel(data) {
return request({
url: '/api/productOut/allCancel',
method: 'post',
data
})
}
export function oneCancel(data) {
return request({
url: '/api/productOut/oneCancel',
method: 'post',
data
})
}
export function setPoint(data) {
return request({
url: '/api/productOut/setPoint',
method: 'post',
data
})
}
export function oneSetPoint(data) {
return request({
url: '/api/productOut/oneSetPoint',
method: 'post',
data
})
}
export function getStructIvt(params) {
return request({
url: '/api/productOut/getStructIvt',
method: 'get',
params
})
}
export function manualDiv(data) {
return request({
url: '/api/productOut/manualDiv',
method: 'post',
data
})
}
export function confirm(data) {
return request({
url: '/api/productOut/confirm',
method: 'post',
data
})
}
export function issueTask(data) {
return request({
url: '/api/productOut/issueTask',
method: 'post',
data
})
}
export function finishTask(data) {
return request({
url: '/api/productOut/finishTask',
method: 'post',
data
})
}
export function cancleTaskfinish(data) {
return request({
url: '/api/productOut/cancleTaskfinish',
method: 'post',
data
})
}
export function paramByCodeType(data) {
return request({
url: '/api/productOut/paramByCodeType',
method: 'post',
data
})
}
export function schAreaType(data) {
return request({
url: '/api/productOut/schAreaType',
method: 'post',
data
})
}
export function backConfirm(data) {
return request({
url: '/api/productOut/backConfirm',
method: 'post',
data
})
}
export function getType() {
return request({
url: '/api/productOut/getType',
method: 'get'
})
}
export function moneySubmit(data) {
return request({
url: '/api/productOut/moneySubmit',
method: 'post',
data
})
}
export function getDisNum(data) {
return request({
url: '/api/productOut/getDisNum',
method: 'post',
data
})
}
export function queryBox(data) {
return request({
url: '/api/productOut/queryBox',
method: 'post',
data
})
}
export function getOutBillTask2(data) {
return request({
url: '/api/productOut/getOutBillTask2',
method: 'post',
data
})
}
export function cancelTask(data) {
return request({
url: '/api/productOut/cancelTask',
method: 'post',
data
})
}
export function allSetPoint(data) {
return request({
url: '/api/productOut/allSetPoint',
method: 'post',
data
})
}
export function oneSetPoint2(data) {
return request({
url: '/api/productOut/oneSetPoint2',
method: 'post',
data
})
}
export default { add, edit, del, allDiv, allCancel, getOutBillDtl, getOutBillDis, setPoint, oneSetPoint, getOutBillTask, getStructIvt, manualDiv, confirm, issueTask, finishTask, cancleTaskfinish, getInvTypes, paramByCodeType, schAreaType, backConfirm, getOutBillDisDtl, getType, allDivOne, moneySubmit, getDisNum, queryBox, getOutBillTask2, oneCancel, cancelTask, allSetPoint, oneSetPoint2 }