修改
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
|
||||
package org.nl.pda.sb.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
import org.nl.pda.sb.service.SparePartService;
|
||||
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.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @date 2021-07-26
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "手持工序任务")
|
||||
@RequestMapping("api/pda/sb/")
|
||||
@Slf4j
|
||||
public class SparePartController {
|
||||
private final SparePartService sparePartService;
|
||||
|
||||
@PostMapping("/queryReturnDis")
|
||||
@Log("扫描工艺指令卡")
|
||||
@ApiOperation("扫描工艺指令卡")
|
||||
public ResponseEntity<Object> queryReturnDis(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.queryReturnDis(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/confirmReturn")
|
||||
@Log("扫描工艺指令卡")
|
||||
@ApiOperation("扫描工艺指令卡")
|
||||
public ResponseEntity<Object> confirmReturn(@RequestBody Map whereJson) {
|
||||
return new ResponseEntity<>(sparePartService.confirmReturn(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.nl.pda.sb.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface SparePartService {
|
||||
/**
|
||||
* 校验并查询载具信息
|
||||
*
|
||||
* @param jsonObject 条件
|
||||
* @return Map
|
||||
*/
|
||||
Map<String, Object> queryReturnDis(Map jsonObject);
|
||||
|
||||
Map<String, Object> confirmReturn(Map jsonObject);
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
package org.nl.pda.sb.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.ext.acs.service.WmsToAcsService;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.pda.exception.PdaRequestException;
|
||||
import org.nl.pda.pdm.service.PdmWorkTaskService;
|
||||
import org.nl.pda.sb.service.SparePartService;
|
||||
import org.nl.pda.st.vehicle.service.impl.EmptyVehicleServiceImpl;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.utils.SpringContextHolder;
|
||||
import org.nl.wms.basedata.master.service.ClassstandardService;
|
||||
import org.nl.wms.basedata.st.service.StorattrService;
|
||||
import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
||||
import org.nl.wms.sb.core.service.SparePartInService;
|
||||
import org.nl.wms.sb.core.service.impl.SparePartInServiceImpl;
|
||||
import org.nl.wms.sch.manage.AbstractAcsTask;
|
||||
import org.nl.wms.st.core.task.InTask;
|
||||
import org.nl.wms.st.vehicle.task.ProductTask;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SparePartServiceImpl implements SparePartService {
|
||||
|
||||
@Autowired
|
||||
private final StorattrService storattrService;
|
||||
@Autowired
|
||||
private final SparePartInServiceImpl sparePartInService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryReturnDis(Map jsonObject) {
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
|
||||
String sparepart_only_id = jo.getString("sparepart_only_id");
|
||||
|
||||
if (StrUtil.isEmpty(sparepart_only_id)) {
|
||||
throw new PdaRequestException("备品备件不能为空!");
|
||||
}
|
||||
|
||||
JSONObject spare_bom = WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").query("sparepart_only_id = '"+sparepart_only_id+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(spare_bom)){
|
||||
throw new PdaRequestException("该备件未查询到设备档案BOM备件表!");
|
||||
}
|
||||
|
||||
String device_id = spare_bom.getString("devicerecord_id");
|
||||
|
||||
JSONObject row = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag","1").addParam("device_id",device_id).addParam("sparepart_only_id",sparepart_only_id).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jo)){
|
||||
if (ObjectUtil.isEmpty(spare_bom)){
|
||||
throw new PdaRequestException("该备件未查询到相关领用出库记录!");
|
||||
}
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> confirmReturn(Map jsonObject) {
|
||||
WQLObject mst_wql = WQLObject.getWQLObject("EM_BI_IOStorInv");
|
||||
WQLObject dtl_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDtl");
|
||||
WQLObject dis_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDis");
|
||||
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
throw new PdaRequestException("传入参数不能为空!");
|
||||
}
|
||||
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
|
||||
|
||||
JSONArray rows= jo.getJSONArray("rows");
|
||||
String device_code = rows.getJSONObject(0).getString("device_code");
|
||||
String device_id = rows.getJSONObject(0).getString("device_id");
|
||||
String device_name = rows.getJSONObject(0).getString("device_name");
|
||||
String stor_id = rows.getJSONObject(0).getString("stor_id");
|
||||
String iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
if (!row.getString("device_code").equals(device_code)){
|
||||
throw new PdaRequestException("关联设备需相同!");
|
||||
}
|
||||
JSONObject dis_jo = new JSONObject();
|
||||
//判断该分配是否存在明细
|
||||
JSONObject dtl = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"' AND material_id = '"+row.getString("material_id")+"'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(dtl)){
|
||||
//插入一条入库明细
|
||||
dtl = new JSONObject();
|
||||
dtl.put("iostorinvdtl_id", IdUtil.getSnowflake(1, 1).nextId() + "");
|
||||
dtl.put("iostorinv_id", iostorinv_id);
|
||||
JSONArray dtl_rows = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
dtl.put("seq_no", (dtl_rows.size() + 1) + "");
|
||||
dtl.put("bill_status", "99");
|
||||
dtl.put("material_id",row.getString("material_id"));
|
||||
dtl.put("pcsn",row.getString("pcsn"));
|
||||
dtl.put("qty_unit_id",row.getString("qty_unit_id"));
|
||||
dtl.put("qty_unit_name",row.getString("qty_unit_name"));
|
||||
dtl.put("source_billdtl_id",row.getString("source_billdtl_id"));
|
||||
dtl.put("base_billdtl_id",row.getString("source_billdtl_id"));
|
||||
dtl.put("source_bill_type",row.getString("source_bill_type"));
|
||||
dtl.put("base_bill_type",row.getString("source_bill_type"));
|
||||
dtl.put("source_bill_code",row.getString("source_bill_code"));
|
||||
dtl.put("base_bill_code",row.getString("source_bill_code"));
|
||||
dtl.put("source_bill_table",row.getString("source_bill_table"));
|
||||
dtl.put("base_bill_table",row.getString("source_bill_table"));
|
||||
dtl.put("plan_qty","1");
|
||||
dtl.put("real_qty","1");
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").insert(dtl);
|
||||
}else {
|
||||
dtl.put("plan_qty",dtl.getDoubleValue("plan_qty")+1);
|
||||
dtl.put("real_qty",dtl.getDoubleValue("real_qty")+1);
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInvDtl").update(dtl);
|
||||
}
|
||||
dis_jo.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
dis_jo.put("iostorinv_id", iostorinv_id);
|
||||
dis_jo.put("iostorinvdtl_id", dtl.getString("iostorinvdtl_id"));
|
||||
dis_jo.put("disseq_no", i + 1);
|
||||
dis_jo.put("material_id", dtl.getString("material_id"));
|
||||
dis_jo.put("pcsn", "999999");
|
||||
dis_jo.put("real_qty", "1");
|
||||
dis_jo.put("work_status", "01");
|
||||
dis_jo.put("qty_unit_id", dtl.getString("qty_unit_id"));
|
||||
dis_jo.put("qty_unit_name", dtl.getString("qty_unit_name"));
|
||||
JSONObject stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("is_attachment = '1'").uniqueResult(0);
|
||||
JSONObject struct = WQLObject.getWQLObject("st_ivt_structattr").query("stor_id = '"+stor.getString("stor_id")+"' order by sect_code").uniqueResult(0);
|
||||
dis_jo.put("sect_id", struct.getString("sect_id"));
|
||||
dis_jo.put("sect_code", struct.getString("sect_code"));
|
||||
dis_jo.put("sect_name", struct.getString("sect_name"));
|
||||
dis_jo.put("struct_id", struct.getString("struct_id"));
|
||||
dis_jo.put("struct_code", struct.getString("struct_code"));
|
||||
dis_jo.put("struct_name", struct.getString("struct_name"));
|
||||
dis_jo.put("sparepart_only_id", row.getString("sparepart_only_id"));
|
||||
dis_wql.insert(dis_jo);
|
||||
|
||||
//更新设备bom
|
||||
WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").delete("sparepart_only_id = '"+row.getString("sparepart_only_id")+"' AND devicerecord_id = '"+device_id+"'");
|
||||
}
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
//插入主表
|
||||
JSONObject io_mst = new JSONObject();
|
||||
String bill_code = CodeUtil.getNewCode("IO_CODE");
|
||||
io_mst.put("iostorinv_id", iostorinv_id);
|
||||
io_mst.put("bill_code", bill_code);
|
||||
io_mst.put("buss_type","0008");
|
||||
io_mst.put("io_type", "0");
|
||||
io_mst.put("bill_type", "000801");
|
||||
io_mst.put("biz_date", DateUtil.today());
|
||||
StorattrDto storattrDto = storattrService.findById(Long.parseLong(stor_id));
|
||||
String stor_code = storattrDto.getStor_code();
|
||||
String stor_name = storattrDto.getStor_name();
|
||||
io_mst.put("stor_id", stor_id);
|
||||
io_mst.put("stor_code", stor_code);
|
||||
io_mst.put("stor_name", stor_name);
|
||||
JSONArray dis_num = dis_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
io_mst.put("total_qty", dis_num.size());
|
||||
JSONArray dtl_num = dtl_wql.query("iostorinv_id = '"+iostorinv_id+"'").getResultJSONArray(0);
|
||||
io_mst.put("detail_count", dtl_num.size());
|
||||
io_mst.put("bill_status", "40");
|
||||
io_mst.put("create_mode", "01");
|
||||
io_mst.put("input_optid", currentUserId + "");
|
||||
io_mst.put("input_optname", nickName);
|
||||
io_mst.put("input_time", now);
|
||||
io_mst.put("update_optid", currentUserId + "");
|
||||
io_mst.put("update_optname", nickName);
|
||||
io_mst.put("update_time", now);
|
||||
io_mst.put("device_id", device_id);
|
||||
io_mst.put("device_code", device_code);
|
||||
io_mst.put("device_name", device_name);
|
||||
io_mst.put("is_delete", "0");
|
||||
io_mst.put("is_upload", "0");
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
io_mst.put("sysdeptid", deptId + "");
|
||||
io_mst.put("syscompanyid", deptId + "");
|
||||
io_mst.put("bizdeptid", deptId + "");
|
||||
|
||||
WQLObject.getWQLObject("EM_BI_IOStorInv").insert(io_mst);
|
||||
|
||||
//完成主表
|
||||
sparePartInService.confirmMst(iostorinv_id);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
[交易说明]
|
||||
交易名: 库区分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.device_id TYPEAS s_string
|
||||
输入.sparepart_only_id TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
QUERY
|
||||
SELECT
|
||||
dis.sparepart_only_id,
|
||||
mb.material_name,
|
||||
mb.material_model,
|
||||
mb.material_spec,
|
||||
dis.qty_unit_name,
|
||||
dis.qty_unit_id,
|
||||
dtl.iostorinvdtl_id AS source_billdtl_id,
|
||||
mst.bill_type AS source_bill_type,
|
||||
mst.bill_code AS source_bill_code,
|
||||
'EM_BI_IOStorInv' AS source_bill_table,
|
||||
'领用出库' AS source_type_name,
|
||||
dis.material_id,
|
||||
file.device_code
|
||||
FROM
|
||||
em_bi_iostorinvdis dis
|
||||
LEFT JOIN em_bi_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
LEFT JOIN em_bi_iostorinvdtl dtl ON dtl.iostorinvdtl_id = dis.iostorinvdtl_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = dis.material_id
|
||||
LEFT JOIN em_bi_equipmentfile file ON file.devicerecord_id = mst.device_id
|
||||
LEFT JOIN
|
||||
WHERE
|
||||
dis.sparepart_only_id = 输入.sparepart_only_id
|
||||
AND mst.device_id = 输入.device_id
|
||||
AND mst.bill_status = '99'
|
||||
AND mst.is_delete = '0'
|
||||
AND dis.work_status = '99'
|
||||
ORDER BY
|
||||
mst.biz_date DESC
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
@@ -93,12 +93,12 @@ public class SparePartOutController {
|
||||
return new ResponseEntity<>(sparePartOutService.getIvt(whereJson), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/createCode")
|
||||
@PostMapping("/insertDis")
|
||||
@Log("生成备件码")
|
||||
@ApiOperation("分配货位")
|
||||
//@PreAuthorize("@el.check('materialtype:list')")
|
||||
public ResponseEntity<Object> createCode(@RequestBody JSONObject jo) {
|
||||
sparePartOutService.createCode(jo);
|
||||
public ResponseEntity<Object> insertDis(@RequestBody JSONObject jo) {
|
||||
sparePartOutService.insertDis(jo);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package org.nl.wms.sb.core.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.annotation.Log;
|
||||
import org.nl.wms.sb.core.service.SparePartOutService;
|
||||
import org.nl.wms.sb.core.service.SparePartReturnService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "备件出库")
|
||||
@RequestMapping("/api/sb/return")
|
||||
@Slf4j
|
||||
public class SparePartReturnController {
|
||||
|
||||
@Autowired
|
||||
private SparePartReturnService sparePartReturnService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询备件出库")
|
||||
@ApiOperation("查询原辅料入库单据")
|
||||
//@PreAuthorize("@el.check('checkoutbill:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(sparePartReturnService.pageQuery(whereJson,page), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public interface SparePartOutService {
|
||||
|
||||
JSONArray getIODtl(Map whereJson);
|
||||
|
||||
void createCode(JSONObject jo);
|
||||
void insertDis(JSONObject jo);
|
||||
|
||||
void cancelCreate(JSONObject whereJson);
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.sb.core.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface SparePartReturnService {
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> pageQuery(Map whereJson, Pageable page);
|
||||
|
||||
}
|
||||
@@ -93,6 +93,10 @@ public class SparePartOutServiceImpl implements SparePartOutService {
|
||||
String stor_code = storattrDto.getStor_code();
|
||||
String stor_name = storattrDto.getStor_name();
|
||||
io_mst.put("stor_id", whereJson.get("stor_id"));
|
||||
io_mst.put("bizdeptid", whereJson.get("bizdeptid"));
|
||||
io_mst.put("device_id", whereJson.get("device_id"));
|
||||
io_mst.put("device_code", whereJson.get("device_code"));
|
||||
io_mst.put("device_name", whereJson.get("device_name"));
|
||||
io_mst.put("stor_code", stor_code);
|
||||
io_mst.put("stor_name", stor_name);
|
||||
io_mst.put("total_qty", whereJson.get("total_qty"));
|
||||
@@ -199,7 +203,7 @@ public class SparePartOutServiceImpl implements SparePartOutService {
|
||||
String search = whereJson.getString("search");
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "11");
|
||||
if (StrUtil.isNotEmpty(search)){
|
||||
if (StrUtil.isNotEmpty(search)) {
|
||||
map.put("search", search);
|
||||
}
|
||||
JSONArray dtl_rows = WQL.getWO("QEM_BI_SPAREPARTOUT").addParamMap(map).process().getResultJSONArray(0);
|
||||
@@ -212,7 +216,7 @@ public class SparePartOutServiceImpl implements SparePartOutService {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "12");
|
||||
map.put("material_id", whereJson.getString("material_id"));
|
||||
if (StrUtil.isNotEmpty(search)){
|
||||
if (StrUtil.isNotEmpty(search)) {
|
||||
map.put("search", search);
|
||||
}
|
||||
JSONArray dtl_rows = WQL.getWO("QEM_BI_SPAREPARTOUT").addParamMap(map).process().getResultJSONArray(0);
|
||||
@@ -221,53 +225,58 @@ public class SparePartOutServiceImpl implements SparePartOutService {
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void createCode(JSONObject form) {
|
||||
public void insertDis(JSONObject form) {
|
||||
WQLObject mst_wql = WQLObject.getWQLObject("EM_BI_IOStorInv");
|
||||
WQLObject dtl_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDtl");
|
||||
WQLObject dis_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDis");
|
||||
WQLObject struct_wql = WQLObject.getWQLObject("st_ivt_structattr");
|
||||
|
||||
JSONObject jo = form.getJSONObject("dtl_row");
|
||||
String sect_id = form.getString("sect_id");
|
||||
String stor_id = form.getString("stor_id");
|
||||
JSONObject jo = form.getJSONObject("row");
|
||||
JSONArray rows = form.getJSONArray("rows");
|
||||
String iostorinvdtl_id = jo.getString("iostorinvdtl_id");
|
||||
JSONObject dtl_jo = dtl_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
|
||||
if (!dtl_jo.getString("bill_status").equals("10")) {
|
||||
throw new BadRequestException("明细状态必须为生成!");
|
||||
if (!dtl_jo.getString("bill_status").equals("10") && !dtl_jo.getString("bill_status").equals("20") && !dtl_jo.getString("bill_status").equals("30")) {
|
||||
throw new BadRequestException("明细状态必须为生成、提交、分配中!");
|
||||
}
|
||||
|
||||
JSONObject struct = struct_wql.query("sect_id = '" + sect_id + "' AND stor_id = '" + stor_id + "' AND is_delete = '0' AND is_used = '1' order by struct_code").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(struct)) {
|
||||
throw new BadRequestException("未查询到该库区下存在可分配的仓位!");
|
||||
if (rows.size() == 0) {
|
||||
throw new BadRequestException("至少选择一条分配记录!");
|
||||
}
|
||||
int num = dtl_jo.getInteger("plan_qty");
|
||||
|
||||
//备件实例化插入分配表
|
||||
for (int i = 0; i < num; i++) {
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject dis_row = rows.getJSONObject(i);
|
||||
JSONObject dis_jo = new JSONObject();
|
||||
dis_jo.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
dis_jo.put("iostorinv_id", dtl_jo.getString("iostorinv_id"));
|
||||
dis_jo.put("iostorinvdtl_id", dtl_jo.getString("iostorinvdtl_id"));
|
||||
dis_jo.put("disseq_no", i + 1);
|
||||
dis_jo.put("material_id", dtl_jo.getString("material_id"));
|
||||
JSONArray ass_dis = dis_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").getResultJSONArray(0);
|
||||
dis_jo.put("disseq_no", ass_dis.size() + 1);
|
||||
dis_jo.put("material_id", dis_row.getString("material_id"));
|
||||
dis_jo.put("pcsn", "999999");
|
||||
dis_jo.put("real_qty", "1");
|
||||
dis_jo.put("work_status", "10");
|
||||
dis_jo.put("qty_unit_id", dtl_jo.getString("qty_unit_id"));
|
||||
dis_jo.put("qty_unit_name", dtl_jo.getString("qty_unit_name"));
|
||||
dis_jo.put("sect_id", struct.getString("sect_id"));
|
||||
dis_jo.put("sect_code", struct.getString("sect_code"));
|
||||
dis_jo.put("sect_name", struct.getString("sect_name"));
|
||||
dis_jo.put("struct_id", struct.getString("struct_id"));
|
||||
dis_jo.put("struct_code", struct.getString("struct_code"));
|
||||
dis_jo.put("struct_name", struct.getString("struct_name"));
|
||||
dis_jo.put("sparepart_only_id", CodeUtil.getNewCode("SPARE_CODE"));
|
||||
dis_jo.put("work_status", "01");
|
||||
dis_jo.put("qty_unit_id", dis_row.getString("qty_unit_id"));
|
||||
dis_jo.put("qty_unit_name", dis_row.getString("qty_unit_name"));
|
||||
dis_jo.put("sect_id", dis_row.getString("sect_id"));
|
||||
dis_jo.put("sect_code", dis_row.getString("sect_code"));
|
||||
dis_jo.put("sect_name", dis_row.getString("sect_name"));
|
||||
dis_jo.put("struct_id", dis_row.getString("struct_id"));
|
||||
dis_jo.put("struct_code", dis_row.getString("struct_code"));
|
||||
dis_jo.put("struct_name", dis_row.getString("struct_name"));
|
||||
dis_jo.put("sparepart_only_id", dis_row.getString("sparepart_only_id"));
|
||||
dis_wql.insert(dis_jo);
|
||||
}
|
||||
|
||||
//修改明细状态
|
||||
double plan_qty = dtl_jo.getDoubleValue("plan_qty");
|
||||
|
||||
HashMap<String, String> dtl_map = new HashMap<>();
|
||||
dtl_map.put("bill_status", "40");
|
||||
if (plan_qty <= rows.size()) {
|
||||
dtl_map.put("bill_status", "40");
|
||||
} else {
|
||||
dtl_map.put("bill_status", "30");
|
||||
}
|
||||
|
||||
dtl_wql.update(dtl_map, "iostorinvdtl_id = '" + iostorinvdtl_id + "'");
|
||||
|
||||
//修改主表状态
|
||||
@@ -294,23 +303,35 @@ public class SparePartOutServiceImpl implements SparePartOutService {
|
||||
WQLObject dtl_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDtl");
|
||||
WQLObject dis_wql = WQLObject.getWQLObject("EM_BI_IOStorInvDis");
|
||||
|
||||
String iostorinvdtl_id = whereJson.getString("iostorinvdtl_id");
|
||||
|
||||
JSONObject dtl_jo = dtl_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").uniqueResult(0);
|
||||
if (!dtl_jo.getString("bill_status").equals("40")) {
|
||||
throw new BadRequestException("明细状态必须为分配完!");
|
||||
JSONObject dtl_jo = whereJson.getJSONObject("row");
|
||||
String iostorinvdtl_id = dtl_jo.getString("iostorinvdtl_id");
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
|
||||
if (rows.size() == 0) {
|
||||
throw new BadRequestException("至少选择一条分配记录!");
|
||||
}
|
||||
|
||||
JSONObject finish_dis = dis_wql.query("iostorinvdtl_id = '" + dtl_jo.getString("iostorinvdtl_id") + "' AND work_status = '99'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(finish_dis)) {
|
||||
throw new BadRequestException("存在已经入库完成的备件!");
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject row = rows.getJSONObject(i);
|
||||
String iostorinvdis_id = row.getString("iostorinvdis_id");
|
||||
JSONObject dis_jo = dis_wql.query("iostorinvdis_id = '" + iostorinvdis_id + "'").uniqueResult(0);
|
||||
if (!dis_jo.getString("work_status").equals("01")) {
|
||||
throw new BadRequestException("请选择状态为生成的分配记录!");
|
||||
}
|
||||
dis_wql.delete("iostorinvdis_id = '" + iostorinvdis_id + "'");
|
||||
}
|
||||
|
||||
dis_wql.delete("iostorinvdtl_id = '" + dtl_jo.getString("iostorinvdtl_id") + "'");
|
||||
|
||||
//修改明细状态
|
||||
JSONArray dis_rows = dis_wql.query("iostorinvdtl_id = '" + iostorinvdtl_id + "'").getResultJSONArray(0);
|
||||
HashMap<String, String> dtl_map = new HashMap<>();
|
||||
dtl_map.put("bill_status", "10");
|
||||
if (dis_rows.size() > 0) {
|
||||
dtl_map.put("bill_status", "30");
|
||||
} else {
|
||||
dtl_map.put("bill_status", "10");
|
||||
}
|
||||
|
||||
dtl_wql.update(dtl_map, "iostorinvdtl_id = '" + iostorinvdtl_id + "'");
|
||||
|
||||
//修改主表状态
|
||||
@@ -438,23 +459,11 @@ public class SparePartOutServiceImpl implements SparePartOutService {
|
||||
for (int i = 0; i < dis_rows.size(); i++) {
|
||||
JSONObject row = dis_rows.getJSONObject(i);
|
||||
|
||||
//插入库存表
|
||||
JSONObject ivt_jo = new JSONObject();
|
||||
ivt_jo.put("stockrecord_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
ivt_jo.put("sparepart_only_id", row.getString("sparepart_only_id"));
|
||||
ivt_jo.put("material_id", row.getString("material_id"));
|
||||
ivt_jo.put("pcsn", row.getString("pcsn"));
|
||||
JSONObject struct = WQLObject.getWQLObject("st_ivt_structattr").query("struct_id = '" + row.getString("struct_id") + "'").uniqueResult(0);
|
||||
ivt_jo.put("stor_id", struct.getString("stor_id"));
|
||||
ivt_jo.put("stor_name", struct.getString("stor_name"));
|
||||
ivt_jo.put("struct_id", row.getString("struct_id"));
|
||||
ivt_jo.put("struct_code", row.getString("struct_code"));
|
||||
ivt_jo.put("struct_name", row.getString("struct_name"));
|
||||
ivt_jo.put("qty_unit_id", row.getString("qty_unit_id"));
|
||||
ivt_jo.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
ivt_jo.put("ivt_qty", "1");
|
||||
ivt_jo.put("instorage_time", now);
|
||||
WQLObject.getWQLObject("EM_BI_DeviceSparePartIvt").insert(ivt_jo);
|
||||
|
||||
//删除库存表
|
||||
JSONObject ivt_jo = new JSONObject();
|
||||
WQLObject.getWQLObject("EM_BI_DeviceSparePartIvt").delete("sparepart_only_id = '" + row.getString("sparepart_only_id") + "'");
|
||||
|
||||
//插入出入库记录表
|
||||
JSONObject record_jo = new JSONObject();
|
||||
@@ -479,6 +488,19 @@ public class SparePartOutServiceImpl implements SparePartOutService {
|
||||
record_jo.put("source_bill_code", mst.getString("bill_code"));
|
||||
record_jo.put("source_bill_table", "EM_BI_IOStorInv");
|
||||
WQLObject.getWQLObject("EM_BI_DeviceSparePartIOStorInvRecord").insert(record_jo);
|
||||
|
||||
if (StrUtil.isNotEmpty(mst.getString("device_id")) && mst.getString("bill_type").equals("010901")) {
|
||||
JSONObject bom = new JSONObject();
|
||||
bom.put("device_file_spare_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
bom.put("devicerecord_id", mst.getString("device_id"));
|
||||
bom.put("sparepart_only_id", row.getString("sparepart_only_id"));
|
||||
bom.put("material_id", row.getString("material_id"));
|
||||
bom.put("pcsn", row.getString("pcsn"));
|
||||
bom.put("qty_unit_id", row.getString("qty_unit_id"));
|
||||
bom.put("qty_unit_name", row.getString("qty_unit_name"));
|
||||
bom.put("qty", "1");
|
||||
WQLObject.getWQLObject("EM_BI_EquipmentSpareBOM").insert(bom);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package org.nl.wms.sb.core.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.st.service.StorattrService;
|
||||
import org.nl.wms.basedata.st.service.dto.StorattrDto;
|
||||
import org.nl.wms.common.util.DataAuthUtil;
|
||||
import org.nl.wms.sb.core.service.SparePartInService;
|
||||
import org.nl.wms.sb.core.service.SparePartReturnService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* PC端出入库新增
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class SparePartReturnServiceImpl implements SparePartReturnService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> pageQuery(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("flag", "1");
|
||||
map.put("buss_type", (String) whereJson.get("buss_type"));
|
||||
map.put("stor_id", (String) whereJson.get("stor_id"));
|
||||
map.put("bill_type", (String) whereJson.get("bill_type"));
|
||||
map.put("create_mode", (String) whereJson.get("create_mode"));
|
||||
map.put("bill_status", (String) whereJson.get("bill_status"));
|
||||
String bill_code = MapUtil.getStr(whereJson, "bill_code");
|
||||
if (!ObjectUtil.isEmpty(bill_code)) {
|
||||
map.put("bill_code", "%" + bill_code + "%");
|
||||
}
|
||||
String begin_time = (String) whereJson.get("begin_time");
|
||||
|
||||
//根据系统参数判断是否需要使用部门进行数据权限过滤
|
||||
String deptIds = DataAuthUtil.getDeptStr();
|
||||
map.put("deptIds", deptIds);
|
||||
|
||||
if (!StrUtil.isEmpty(begin_time)) {
|
||||
map.put("begin_time", begin_time);
|
||||
}
|
||||
String end_time = (String) whereJson.get("end_time");
|
||||
if (!StrUtil.isEmpty(end_time)) {
|
||||
map.put("end_time", end_time);
|
||||
}
|
||||
|
||||
JSONObject jo = WQL.getWO("QEM_BI_SPAREPART").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "input_time desc");
|
||||
return jo;
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
(case when dis.work_status = '10' then '生成' when dis.work_status = '99' then '完成' end) AS status_name,
|
||||
(case when dis.work_status = '01' then '生成' when dis.work_status = '99' then '完成' end) AS status_name,
|
||||
dis.sparepart_only_id,
|
||||
mb.material_name,
|
||||
dis.pcsn,
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
输入.flag TYPEAS s_string
|
||||
输入.bill_code TYPEAS s_string
|
||||
输入.material_search TYPEAS s_string
|
||||
输入.search TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.bill_status TYPEAS s_string
|
||||
@@ -190,7 +191,7 @@
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
(case when dis.work_status = '10' then '生成' when dis.work_status = '99' then '完成' end) AS status_name,
|
||||
(case when dis.work_status = '01' then '生成' when dis.work_status = '99' then '完成' end) AS status_name,
|
||||
dis.sparepart_only_id,
|
||||
mb.material_name,
|
||||
dis.pcsn,
|
||||
@@ -449,7 +450,27 @@
|
||||
MAX( qty_unit_id ) AS qty_unit_id,
|
||||
SUM( ivt_qty ) AS sum_qty
|
||||
FROM
|
||||
EM_BI_DeviceSparePartIvt b
|
||||
(
|
||||
SELECT
|
||||
material_id,
|
||||
qty_unit_name,
|
||||
qty_unit_id,
|
||||
ivt_qty
|
||||
FROM
|
||||
EM_BI_DeviceSparePartIvt ivt
|
||||
WHERE
|
||||
ivt.sparepart_only_id NOT IN (
|
||||
SELECT
|
||||
dis.sparepart_only_id
|
||||
FROM
|
||||
EM_BI_IOStorInv mst
|
||||
LEFT JOIN EM_BI_IOStorInvDis dis ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
io_type = '1'
|
||||
AND bill_status <> '99'
|
||||
AND dis.iostorinvdis_id IS NOT NULL
|
||||
)
|
||||
) c
|
||||
GROUP BY
|
||||
material_id
|
||||
) a ON a.material_id = mb.material_id
|
||||
@@ -469,20 +490,47 @@
|
||||
QUERY
|
||||
SELECT
|
||||
sa.sect_name,
|
||||
sa.struct_name,
|
||||
ivt.sparepart_only_id,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
ivt.pcsn,
|
||||
ivt.ivt_qty,
|
||||
ivt.qty_unit_name,
|
||||
ivt.instorage_time
|
||||
sa.sect_id,
|
||||
sa.sect_code,
|
||||
sa.struct_id,
|
||||
sa.struct_code,
|
||||
sa.struct_name,
|
||||
ivt.sparepart_only_id,
|
||||
mb.material_code,
|
||||
mb.material_name,
|
||||
ivt.pcsn,
|
||||
ivt.ivt_qty,
|
||||
ivt.qty_unit_id,
|
||||
ivt.qty_unit_name,
|
||||
ivt.instorage_time,
|
||||
ivt.material_id
|
||||
FROM
|
||||
em_bi_devicesparepartivt ivt
|
||||
LEFT JOIN st_ivt_structattr sa ON sa.struct_id = ivt.struct_id
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt.material_id
|
||||
WHERE
|
||||
ivt.material_id = 输入.material_id
|
||||
OPTION 输入.search <> ""
|
||||
(ivt.sparepart_only_id = 输入.search OR sa.struct_code = 输入.search OR sa.struct_name = 输入.search)
|
||||
ENDOPTION
|
||||
OPTION 输入.stor_id <> ""
|
||||
sa.stor_id = 输入.stor_id
|
||||
ENDOPTION
|
||||
OPTION 输入.sect_id <> ""
|
||||
sa.sect_id = 输入.sect_id
|
||||
ENDOPTION
|
||||
AND
|
||||
ivt.sparepart_only_id NOT IN (
|
||||
SELECT
|
||||
dis.sparepart_only_id
|
||||
FROM
|
||||
EM_BI_IOStorInv mst
|
||||
LEFT JOIN EM_BI_IOStorInvDis dis ON mst.iostorinv_id = dis.iostorinv_id
|
||||
WHERE
|
||||
io_type = '1'
|
||||
AND bill_status <> '99'
|
||||
AND dis.iostorinvdis_id IS NOT NULL
|
||||
)
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
@@ -104,9 +104,9 @@ export function getStructIvt(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function createCode(data) {
|
||||
export function insertDis(data) {
|
||||
return request({
|
||||
url: '/api/sb/outbill/createCode',
|
||||
url: '/api/sb/outbill/insertDis',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
@@ -177,5 +177,5 @@ export function getIvt(data) {
|
||||
}
|
||||
|
||||
export default { add, edit, del, getType, getBillDtl, disConfirm, insertDtl, getIODtl, commit, checkVehicle,
|
||||
deleteDisDtl, getDisDtl, createCode, divPoint, cancelCreate, getIvt, getStructIvt,
|
||||
deleteDisDtl, getDisDtl, insertDis, divPoint, cancelCreate, getIvt, getStructIvt,
|
||||
divStruct, bucketDtl, confirm, backConfirm }
|
||||
|
||||
@@ -206,9 +206,9 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
checkoutbill.getInvTypes().then(res => {
|
||||
crudRawAssist.getType({}).then(res => {
|
||||
this.billtypelist = res
|
||||
}),
|
||||
})
|
||||
// 查询原材料库的仓库
|
||||
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
|
||||
this.storlist = res.content
|
||||
|
||||
@@ -48,7 +48,9 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="关联设备" prop="bizperson">
|
||||
<label slot="label">关联设备:</label>
|
||||
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
|
||||
<el-input v-model="form.device_code" size="mini" style="width: 210px">
|
||||
<el-button slot="append" icon="el-icon-plus" @click="putDevice"/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库" prop="stor_id">
|
||||
<label slot="label">仓 库:</label>
|
||||
@@ -68,13 +70,18 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务部门" prop="bizperson">
|
||||
<label slot="label">业务部门:</label>
|
||||
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
|
||||
<el-form-item label="业务部门" prop="bizdeptid">
|
||||
<treeselect
|
||||
v-model="form.bizdeptid"
|
||||
:options="depts"
|
||||
:load-options="loadDepts"
|
||||
style="width: 200px"
|
||||
placeholder="选择部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务人员" prop="bizperson">
|
||||
<label slot="label">业务人员:</label>
|
||||
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
|
||||
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="明细数" prop="detail_count">
|
||||
<label slot="label">明 细 数:</label>
|
||||
@@ -176,12 +183,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<MaterDtl
|
||||
:dialog-show.sync="materShow"
|
||||
:is-single="true"
|
||||
:mater-opt-code="materType"
|
||||
@tableChanged2="tableChanged2"
|
||||
/>
|
||||
<MaterDtl :dialog-show.sync="materShow" :is-single="true" :mater-opt-code="materType"
|
||||
@tableChanged2="tableChanged2"/>
|
||||
<DeviceDialog :dialog-show.sync="deviceDialog" :is-single="true" @tableChanged2="tableChanged"/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -192,7 +196,10 @@ import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
import sparePart from '@/api/wms/sb/sparepartout'
|
||||
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
|
||||
import MaterDtl from '@/views/wms/sb/outbill/IvtDialog'
|
||||
import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill'
|
||||
import DeviceDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/DeviceDialog'
|
||||
import { getDepts, getDeptSuperior } from '@/api/system/dept'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
const defaultForm = {
|
||||
bill_code: '',
|
||||
@@ -202,6 +209,10 @@ const defaultForm = {
|
||||
detail_count: '0',
|
||||
bill_type: '',
|
||||
remark: '',
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
bizdeptid: null,
|
||||
device_name: '',
|
||||
bizperson: '',
|
||||
source_id: '',
|
||||
biz_date: new Date().format('yyyy-MM-dd'),
|
||||
@@ -211,7 +222,7 @@ const defaultForm = {
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { crudOperation, MaterDtl },
|
||||
components: { crudOperation, MaterDtl, DeviceDialog, Treeselect },
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
props: {
|
||||
dialogShow: {
|
||||
@@ -233,7 +244,9 @@ export default {
|
||||
opendtlParam: null,
|
||||
mater_btn: false,
|
||||
materType: '',
|
||||
deviceDialog: false,
|
||||
storlist: [],
|
||||
depts: [],
|
||||
billtypelist: [],
|
||||
rules: {
|
||||
stor_id: [
|
||||
@@ -264,7 +277,7 @@ export default {
|
||||
this.mater_btn = true
|
||||
}
|
||||
// 查询原材料库的仓库
|
||||
crudStorattr.getStor({ 'is_materialstore': '1' }).then(res => {
|
||||
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
|
||||
this.storlist = res.content
|
||||
this.form.stor_id = this.storlist[0].stor_id
|
||||
})
|
||||
@@ -274,6 +287,59 @@ export default {
|
||||
this.form.bill_type = this.billtypelist[0].code
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterToCU](crud, form) {
|
||||
if (!form.bill_code) {
|
||||
this.getDepts()
|
||||
} else {
|
||||
debugger
|
||||
this.getSupDepts(form.bizdeptid)
|
||||
}
|
||||
},
|
||||
getDepts() {
|
||||
getDepts({ enabled: true }).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
getSupDepts(deptId) {
|
||||
var number = parseFloat(deptId)
|
||||
getDeptSuperior(number).then(res => {
|
||||
const date = res.content
|
||||
this.buildDepts(date)
|
||||
this.depts = date
|
||||
})
|
||||
},
|
||||
buildDepts(depts) {
|
||||
debugger
|
||||
depts.forEach(data => {
|
||||
if (data.children) {
|
||||
this.buildDepts(data.children)
|
||||
}
|
||||
if (data.hasChildren && !data.children) {
|
||||
data.children = null
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 200)
|
||||
})
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 获取入库单明细
|
||||
sparePart.getIODtl({ 'bill_code': this.form.bill_code }).then(res => {
|
||||
@@ -300,6 +366,9 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
putDevice() {
|
||||
this.deviceDialog = true
|
||||
},
|
||||
billTypeChange(val) {
|
||||
this.form.tableData = []
|
||||
this.form.total_qty = 0
|
||||
@@ -318,16 +387,15 @@ export default {
|
||||
this.nowrow.sum_qty = row.sum_qty
|
||||
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
|
||||
},
|
||||
fun(val) {
|
||||
return Number(val).toFixed(3)
|
||||
tableChanged(row) {
|
||||
this.form.device_id = row.devicerecord_id
|
||||
this.form.device_code = row.device_code
|
||||
this.form.device_name = row.device_name
|
||||
},
|
||||
async queryMater(index, row) {
|
||||
checkoutbill.paramByCodeType({ 'bill_type': this.form.bill_type, 'io_flag': '01' }).then(res => {
|
||||
this.materType = res.materType
|
||||
this.materShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
})
|
||||
this.materShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
},
|
||||
async insertdtl() {
|
||||
if (this.form.bill_type == '') {
|
||||
@@ -364,26 +432,6 @@ export default {
|
||||
rows.splice(index, 1)
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
tableChanged(rows) {
|
||||
// 对新增的行进行校验不能存在相同物料批次
|
||||
rows.forEach((item) => {
|
||||
let same_mater = true
|
||||
this.form.tableData.forEach((row) => {
|
||||
if (row.material_id === item.material_id && row.pcsn === item.pcsn) {
|
||||
same_mater = false
|
||||
}
|
||||
})
|
||||
if (same_mater) {
|
||||
item.edit = false
|
||||
item.quality_scode = '00'
|
||||
item.is_active = '1'
|
||||
item.plan_qty = item.need_qty
|
||||
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
|
||||
this.form.tableData.splice(-1, 0, item)
|
||||
}
|
||||
})
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
close() {
|
||||
this.$emit('AddChanged')
|
||||
}
|
||||
|
||||
@@ -56,8 +56,10 @@
|
||||
<el-table-column show-overflow-tooltip prop="material_spec" label="规格" align="center"/>
|
||||
<el-table-column show-overflow-tooltip prop="material_model" label="型号" align="center"/>
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" :formatter="crud.formatNum3" 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="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>
|
||||
</el-card>
|
||||
@@ -98,6 +100,16 @@
|
||||
>
|
||||
删除分配
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="disConfirm()"
|
||||
>
|
||||
确认
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
<el-card class="box-card" shadow="never" :body-style="{padding:'0'}">
|
||||
@@ -122,7 +134,8 @@
|
||||
</el-table>
|
||||
</el-card>
|
||||
|
||||
<StructIvt :dialog-show.sync="structShow" :open-array="ivtParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl"/>
|
||||
<StructIvt :dialog-show.sync="structShow" :open-array="ivtParam" :rowmst="openRow"
|
||||
@StructIvtClosed="queryTableDis"/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -257,15 +270,12 @@ export default {
|
||||
})
|
||||
},
|
||||
cancelCreate() {
|
||||
if (!this.form.dtl_row) {
|
||||
this.crud.notify('请选择一条入库明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
const rows = this.$refs.dis_table.selection
|
||||
if (rows.length === 0) {
|
||||
this.crud.notify('请至少选择一条分配记录', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (this.form.dtl_row.bill_status !== '40') {
|
||||
this.crud.notify('请选择状态为分配完的明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
sparePart.cancelCreate(this.form).then(res => {
|
||||
sparePart.cancelCreate({ rows: rows, row: this.form.dtl_row }).then(res => {
|
||||
sparePart.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
|
||||
this.openParam = res
|
||||
})
|
||||
@@ -280,6 +290,11 @@ export default {
|
||||
this.openParam = res
|
||||
})
|
||||
},
|
||||
queryTableDis() {
|
||||
sparePart.getDisDtl(this.form.dtl_row).then(res => {
|
||||
this.form.tableMater = res
|
||||
})
|
||||
},
|
||||
disConfirm() {
|
||||
debugger
|
||||
let rows = this.$refs.dis_table.selection
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
disabled
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="待分配" prop="unassign_qty">
|
||||
<el-form-item label="需出数" prop="unassign_qty">
|
||||
<el-input-number
|
||||
v-model="queryrow.unassign_qty"
|
||||
:controls="false"
|
||||
@@ -58,11 +58,11 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="关键字" prop="remark">
|
||||
<el-input
|
||||
v-model="queryrow.remark"
|
||||
v-model="queryrow.search"
|
||||
clearable
|
||||
style="width: 220px"
|
||||
size="mini"
|
||||
placeholder="货位编码、名称或载具号"
|
||||
placeholder="货位编码、名称或唯一标识"
|
||||
prefix-icon="el-icon-search"
|
||||
class="filter-item"
|
||||
/>
|
||||
@@ -77,6 +77,7 @@
|
||||
:data="tableDtl"
|
||||
style="width: 100%;"
|
||||
max-height="400"
|
||||
@selection-change="changeNum"
|
||||
border
|
||||
:highlight-current-row="true"
|
||||
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
|
||||
@@ -99,7 +100,7 @@
|
||||
|
||||
import CRUD, { header } from '@crud/crud'
|
||||
import crudSectattr from '@/api/wms/basedata/st/sectattr'
|
||||
import checkoutbill from '@/api/wms/st/core/outbill/checkoutbill'
|
||||
import sparePart from '@/api/wms/sb/sparepartout'
|
||||
|
||||
export default {
|
||||
name: 'StructIvt',
|
||||
@@ -146,14 +147,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
crudSectattr.getSect({ is_materialstore: '1' }).then(res => {
|
||||
crudSectattr.getSect({ is_attachment: '1' }).then(res => {
|
||||
this.sects = res.content
|
||||
})
|
||||
},
|
||||
queryStruct() {
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(this.queryrow.assign_qty)
|
||||
this.queryrow.assign_qty = 0
|
||||
checkoutbill.getStructIvt(this.queryrow).then(res => {
|
||||
sparePart.getStructIvt(this.queryrow).then(res => {
|
||||
this.tableDtl = res
|
||||
})
|
||||
},
|
||||
@@ -171,31 +170,8 @@ export default {
|
||||
this.queryrow.sect_id = val[1]
|
||||
}
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
// 判断是否可以关闭编辑状态
|
||||
if (!row.edit) {
|
||||
if (row.plan_qty > this.queryrow.unassign_qty) {
|
||||
this.crud.notify('出库重量不能超过未分配数', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (row.plan_qty > row.canuse_qty) {
|
||||
this.crud.notify('出库重量不能超过库存可出重量', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
if (row.plan_qty === 0) {
|
||||
this.crud.notify('出库重量为0不能保存', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
row.edit = !row.edit
|
||||
if (row.edit) {
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) - row.plan_qty
|
||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) + row.plan_qty
|
||||
} else {
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + row.plan_qty
|
||||
this.queryrow.assign_qty = parseFloat(this.queryrow.assign_qty) - row.plan_qty
|
||||
}
|
||||
this.tableDtl.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
|
||||
changeNum(rows) {
|
||||
this.queryrow.assign_qty = rows.length
|
||||
},
|
||||
close() {
|
||||
this.$emit('update:dialogShow', false)
|
||||
@@ -206,35 +182,15 @@ export default {
|
||||
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)
|
||||
}
|
||||
})
|
||||
checkoutbill.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)
|
||||
}
|
||||
})
|
||||
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed')
|
||||
})
|
||||
})
|
||||
.catch(_ => {
|
||||
|
||||
})
|
||||
if (parseFloat(this.queryrow.assign_qty) > parseFloat(this.queryrow.unassign_qty)) {
|
||||
this.crud.notify('分配数需小于等于需出数', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
const rows = this.$refs.table.selection
|
||||
sparePart.insertDis({ 'row': this.queryrow, 'rows': rows }).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
<rrOperation/>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
@@ -109,7 +109,7 @@
|
||||
size="mini"
|
||||
@click="divOpen"
|
||||
>
|
||||
备件入库
|
||||
出库分配
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
@@ -136,7 +136,7 @@
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="115"
|
||||
@@ -157,8 +157,8 @@
|
||||
<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" prop="bill_status" label="单据状态" />
|
||||
<el-table-column prop="stor_name" label="仓库" />
|
||||
<el-table-column show-overflow-tooltip :formatter="stateFormat" prop="bill_status" label="单据状态"/>
|
||||
<el-table-column prop="stor_name" label="仓库"/>
|
||||
<el-table-column
|
||||
show-overflow-tooltip
|
||||
prop="bill_type"
|
||||
@@ -166,30 +166,30 @@
|
||||
:formatter="bill_typeFormat"
|
||||
label="业务类型"
|
||||
/>
|
||||
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期" />
|
||||
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式" />
|
||||
<el-table-column label="明细数" align="center" prop="detail_count" />
|
||||
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期"/>
|
||||
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式"/>
|
||||
<el-table-column label="明细数" align="center" prop="detail_count"/>
|
||||
<el-table-column label="总重量" align="center" prop="total_qty">
|
||||
<template slot-scope="scope">
|
||||
{{ fun(scope.row.total_qty) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="制单人" align="center" prop="input_optname" />
|
||||
<el-table-column label="制单时间" align="center" prop="input_time" width="150" />
|
||||
<el-table-column label="修改人" align="center" prop="update_optname" />
|
||||
<el-table-column label="修改时间" align="center" prop="update_time" width="150" />
|
||||
<el-table-column label="分配人" align="center" prop="dis_optname" />
|
||||
<el-table-column label="分配时间" align="center" prop="dis_time" width="150" />
|
||||
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150" />
|
||||
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150" />
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
<el-table-column label="制单人" align="center" prop="input_optname"/>
|
||||
<el-table-column label="制单时间" align="center" prop="input_time" width="150"/>
|
||||
<el-table-column label="修改人" align="center" prop="update_optname"/>
|
||||
<el-table-column label="修改时间" align="center" prop="update_time" width="150"/>
|
||||
<el-table-column label="分配人" align="center" prop="dis_optname"/>
|
||||
<el-table-column label="分配时间" align="center" prop="dis_time" width="150"/>
|
||||
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150"/>
|
||||
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150"/>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
<pagination/>
|
||||
</div>
|
||||
<AddDialog @AddChanged="querytable" />
|
||||
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable" />
|
||||
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig" @AddChanged="querytable" />
|
||||
<AddDialog @AddChanged="querytable"/>
|
||||
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable"/>
|
||||
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig" @AddChanged="querytable"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -210,7 +210,16 @@ import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
|
||||
export default {
|
||||
name: 'Handle',
|
||||
components: { ViewDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker, DivDialog },
|
||||
components: {
|
||||
ViewDialog,
|
||||
AddDialog,
|
||||
crudOperation,
|
||||
rrOperation,
|
||||
udOperation,
|
||||
pagination,
|
||||
DateRangePicker,
|
||||
DivDialog
|
||||
},
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '',
|
||||
@@ -273,7 +282,7 @@ export default {
|
||||
canUd(row) {
|
||||
return row.bill_status !== '10'
|
||||
},
|
||||
toView(index,row){
|
||||
toView(index, row) {
|
||||
this.mstrow = row
|
||||
this.viewShow = true
|
||||
},
|
||||
|
||||
340
mes/qd/src/views/wms/sb/return/index.vue
Normal file
340
mes/qd/src/views/wms/sb/return/index.vue
Normal file
@@ -0,0 +1,340 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div>
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-row>
|
||||
<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']"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关联设备">
|
||||
<el-input
|
||||
v-model="query.device_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="设备编码或名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="领用人">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="备件编码或名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="还回日期">
|
||||
<el-date-picker
|
||||
v-model="query.createTime2"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="['00:00:00', '23:59:59']"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备品备件">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="备件编码或名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="还回人">
|
||||
<el-input
|
||||
v-model="query.search"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="人员编码或名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-form-item label="领用单">
|
||||
<el-input
|
||||
v-model="query.borrow_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="单据号"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="还回单">
|
||||
<el-input
|
||||
v-model="query.return_code"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="单据号"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation/>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
@current-change="handleCurrentChange"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
>
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="115"
|
||||
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 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" prop="bill_status" label="单据状态"/>
|
||||
<el-table-column prop="stor_name" label="仓库"/>
|
||||
<el-table-column
|
||||
show-overflow-tooltip
|
||||
prop="bill_type"
|
||||
width="100"
|
||||
:formatter="bill_typeFormat"
|
||||
label="业务类型"
|
||||
/>
|
||||
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期"/>
|
||||
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式"/>
|
||||
<el-table-column label="明细数" align="center" prop="detail_count"/>
|
||||
<el-table-column label="总重量" align="center" prop="total_qty">
|
||||
<template slot-scope="scope">
|
||||
{{ fun(scope.row.total_qty) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
<el-table-column label="制单人" align="center" prop="input_optname"/>
|
||||
<el-table-column label="制单时间" align="center" prop="input_time" width="150"/>
|
||||
<el-table-column label="修改人" align="center" prop="update_optname"/>
|
||||
<el-table-column label="修改时间" align="center" prop="update_time" width="150"/>
|
||||
<el-table-column label="分配人" align="center" prop="dis_optname"/>
|
||||
<el-table-column label="分配时间" align="center" prop="dis_time" width="150"/>
|
||||
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150"/>
|
||||
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150"/>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination/>
|
||||
</div>
|
||||
<AddDialog @AddChanged="querytable"/>
|
||||
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable"/>
|
||||
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig"
|
||||
@AddChanged="querytable"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sparePart from '@/api/wms/sb/sparepartout'
|
||||
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import ViewDialog from '@/views/wms/sb/inbill/ViewDialog'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import DateRangePicker from '@/components/DateRangePicker/index'
|
||||
import AddDialog from '@/views/wms/sb/outbill/AddDialog'
|
||||
import DivDialog from '@/views/wms/sb/outbill/DivDialog'
|
||||
import { mapGetters } from 'vuex'
|
||||
import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
|
||||
export default {
|
||||
name: 'Handle',
|
||||
components: {
|
||||
ViewDialog,
|
||||
AddDialog,
|
||||
rrOperation,
|
||||
udOperation,
|
||||
pagination,
|
||||
DateRangePicker,
|
||||
DivDialog
|
||||
},
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '',
|
||||
optShow: { add: true, reset: true },
|
||||
idField: 'iostorinv_id',
|
||||
url: '/api/sb/return',
|
||||
crudMethod: { ...sparePart }
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
// 数据字典
|
||||
dicts: ['io_bill_status', 'ST_CREATE_MODE'],
|
||||
data() {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||
permission: {
|
||||
add: ['admin', 'user:add'],
|
||||
edit: ['admin', 'user:edit'],
|
||||
del: ['admin', 'user:del']
|
||||
},
|
||||
audit_flag: true,
|
||||
dis_flag: true,
|
||||
disShow: false,
|
||||
divShow: false,
|
||||
billType: null,
|
||||
openParam: {},
|
||||
bussConfig: null,
|
||||
currentRow: null,
|
||||
viewShow: false,
|
||||
mstrow: {},
|
||||
storlist: [],
|
||||
billtypelist: [],
|
||||
createtypelist: [],
|
||||
statuslist: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'user'
|
||||
])
|
||||
},
|
||||
mounted: function() {
|
||||
const that = this
|
||||
window.onresize = function temp() {
|
||||
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
crudRawAssist.getType({ 'io_code': '0109', 'io_flag': '01' }).then(res => {
|
||||
this.billtypelist = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
fun(val) {
|
||||
return Number(val).toFixed(3)
|
||||
},
|
||||
canUd(row) {
|
||||
return row.bill_status !== '10'
|
||||
},
|
||||
toView(index, row) {
|
||||
this.mstrow = row
|
||||
this.viewShow = true
|
||||
},
|
||||
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(currentRow) {
|
||||
if (currentRow !== null) {
|
||||
this.currentRow = currentRow
|
||||
if (currentRow.bill_status === '10' || currentRow.bill_status === '20' || currentRow.bill_status === '30' || currentRow.bill_status === '40') {
|
||||
this.dis_flag = false
|
||||
} else {
|
||||
this.dis_flag = true
|
||||
}
|
||||
}
|
||||
},
|
||||
handleCurrentChange(currentRow) {
|
||||
if (currentRow === null) {
|
||||
this.dis_flag = true
|
||||
this.currentRow = {}
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
if (this.crud.query.createTime2) {
|
||||
this.crud.query.start_time = this.crud.query.createTime2[0]
|
||||
this.crud.query.last_time = this.crud.query.createTime2[1]
|
||||
}
|
||||
this.crud.query.buss_type = '0109'
|
||||
this.handleCurrentChange(null)
|
||||
},
|
||||
bill_typeFormat(row, column) {
|
||||
for (const item of this.billtypelist) {
|
||||
if (item.code == row.bill_type) {
|
||||
return item.name
|
||||
}
|
||||
}
|
||||
},
|
||||
stateFormat(row, column) {
|
||||
return this.dict.label.io_bill_status[row.bill_status]
|
||||
},
|
||||
create_modeFormat(row, column) {
|
||||
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
||||
},
|
||||
confirm() {
|
||||
if (!this.currentRow) {
|
||||
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
sparePart.confirm(this.currentRow).then(res => {
|
||||
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
divOpen() {
|
||||
if (!this.currentRow) {
|
||||
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
sparePart.getIODtl({ 'bill_code': this.currentRow.bill_code, 'open_flag': '1' }).then(res => {
|
||||
this.openParam = res
|
||||
this.billType = this.currentRow.bill_type
|
||||
this.divShow = true
|
||||
})
|
||||
},
|
||||
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>
|
||||
441
mes/qd/src/views/wms/sb/scrap/AddDialog.vue
Normal file
441
mes/qd/src/views/wms/sb/scrap/AddDialog.vue
Normal file
@@ -0,0 +1,441 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="crud.status.title"
|
||||
fullscreen
|
||||
append-to-body
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
width="1200px"
|
||||
@open="open"
|
||||
@close="close"
|
||||
>
|
||||
<el-row v-show="crud.status.cu > 0" :gutter="20">
|
||||
<el-col :span="20" style="border: 1px solid white">
|
||||
<span/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<span>
|
||||
<el-button icon="el-icon-check" size="mini" :loading="crud.cu === 2" type="primary"
|
||||
@click="crud.submitCU">保存</el-button>
|
||||
<el-button icon="el-icon-close" size="mini" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true"
|
||||
:model="form" :rules="rules" size="mini" label-width="85px" label-suffix=":">
|
||||
<el-form-item label="单据号" prop="bill_code">
|
||||
<label slot="label">单 据 号:</label>
|
||||
<el-input v-model="form.bill_code" disabled placeholder="系统生成" clearable style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务类型" prop="bill_type">
|
||||
<el-select
|
||||
v-model="form.bill_type"
|
||||
clearable
|
||||
placeholder="业务类型"
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
:disabled="crud.status.view > 0"
|
||||
@change="billTypeChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in billtypelist"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库" prop="stor_id">
|
||||
<label slot="label">仓 库:</label>
|
||||
<el-select
|
||||
v-model="form.stor_id"
|
||||
clearable
|
||||
placeholder="仓库"
|
||||
class="filter-item"
|
||||
style="width: 210px"
|
||||
:disabled="crud.status.view > 0"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storlist"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务部门" prop="bizdeptid">
|
||||
<treeselect
|
||||
v-model="form.bizdeptid"
|
||||
:options="depts"
|
||||
:load-options="loadDepts"
|
||||
style="width: 200px"
|
||||
placeholder="选择部门"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="业务人员" prop="bizperson">
|
||||
<label slot="label">业务人员:</label>
|
||||
<el-input v-model="form.bizperson" size="mini" style="width: 210px"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="明细数" prop="detail_count">
|
||||
<label slot="label">明 细 数:</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">总 数 量:</label>
|
||||
<el-input-number
|
||||
v-model="form.total_qty"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="0"
|
||||
disabled
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="摘要" prop="remark">
|
||||
<label slot="label">摘 要:</label>
|
||||
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea"
|
||||
:disabled="crud.status.view > 0"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<div class="crud-opts2" style="margin-bottom: 5px;">
|
||||
<span class="crud-opts-right2">
|
||||
<!--左侧插槽-->
|
||||
<slot name="left"/>
|
||||
<el-button
|
||||
slot="left"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
:disabled="mater_btn"
|
||||
@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="55" 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-plus" @click="queryMater(scope.$index, scope.row)"/>
|
||||
</el-input>
|
||||
<span v-show="!scope.row.edit && mater_btn">{{ scope.row.material_code }}</span>
|
||||
<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 prop="material_model" label="型号" align="center" min-width="150px" show-overflow-tooltip/>
|
||||
<el-table-column prop="sum_qty" label="库存" align="center" min-width="150px" show-overflow-tooltip/>
|
||||
<el-table-column prop="plan_qty" width="220" label="出库数量" align="center">
|
||||
<template scope="scope">
|
||||
<el-input-number v-model="scope.row.plan_qty" :disabled="scope.row.edit" :precision="3" :controls="false"
|
||||
:min="0" style="width: 120px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="qty_unit_name" label="单位" align="center"/>
|
||||
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="190" fixed="right">
|
||||
<template scope="scope">
|
||||
<el-button
|
||||
type="danger"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
icon="el-icon-delete"
|
||||
@click.native.prevent="deleteRow(scope.$index, form.tableData)"
|
||||
/>
|
||||
<el-button
|
||||
v-show="!scope.row.edit"
|
||||
type="primary"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
icon="el-icon-edit"
|
||||
@click="handleEdit(scope.$index, scope.row)"
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-show="scope.row.edit"
|
||||
type="success"
|
||||
class="filter-item"
|
||||
size="mini"
|
||||
icon="el-icon-check"
|
||||
@click="handleEdit(scope.$index, scope.row)"
|
||||
>完成
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<MaterDtl :dialog-show.sync="materShow" :is-single="true" :mater-opt-code="materType" @tableChanged2="tableChanged2"/>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import CRUD, { crud, form } from '@crud/crud'
|
||||
import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
import sparePart from '@/api/wms/sb/sparepartout'
|
||||
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
|
||||
import MaterDtl from '@/views/wms/sb/outbill/IvtDialog'
|
||||
import DeviceDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/DeviceDialog'
|
||||
import { getDepts, getDeptSuperior } from '@/api/system/dept'
|
||||
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
|
||||
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
|
||||
|
||||
const defaultForm = {
|
||||
bill_code: '',
|
||||
stor_id: '',
|
||||
bill_status: '10',
|
||||
total_qty: '0',
|
||||
detail_count: '0',
|
||||
bill_type: '',
|
||||
remark: '',
|
||||
device_code: '',
|
||||
device_id: '',
|
||||
bizdeptid: null,
|
||||
device_name: '',
|
||||
bizperson: '',
|
||||
source_id: '',
|
||||
biz_date: new Date().format('yyyy-MM-dd'),
|
||||
create_mode: '',
|
||||
tableData: []
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { crudOperation, MaterDtl, DeviceDialog, Treeselect },
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
bussConfig: {
|
||||
type: Object
|
||||
},
|
||||
openParam: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
materShow: false,
|
||||
dtlShow: false,
|
||||
opendtlParam: null,
|
||||
mater_btn: false,
|
||||
materType: '',
|
||||
storlist: [],
|
||||
depts: [],
|
||||
billtypelist: [],
|
||||
rules: {
|
||||
stor_id: [
|
||||
{ required: true, message: '仓库不能为空', trigger: 'blur' }
|
||||
],
|
||||
bill_type: [
|
||||
{ required: true, message: '业务类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
biz_date: [
|
||||
{ required: true, message: '业务日期不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
if (this.crud.status.cu > 0) {
|
||||
this.mater_btn = false
|
||||
}
|
||||
if (this.crud.status.view > 0) {
|
||||
this.mater_btn = true
|
||||
}
|
||||
// 查询原材料库的仓库
|
||||
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
|
||||
this.storlist = res.content
|
||||
this.form.stor_id = this.storlist[0].stor_id
|
||||
})
|
||||
// 获取单据类型
|
||||
crudRawAssist.getType({ 'io_code': '0110', 'io_flag': '01' }).then(res => {
|
||||
this.billtypelist = res
|
||||
this.form.bill_type = this.billtypelist[0].code
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.afterToCU](crud, form) {
|
||||
if (!form.bill_code) {
|
||||
this.getDepts()
|
||||
} else {
|
||||
debugger
|
||||
this.getSupDepts(form.bizdeptid)
|
||||
}
|
||||
},
|
||||
getDepts() {
|
||||
getDepts({ enabled: true }).then(res => {
|
||||
this.depts = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
})
|
||||
},
|
||||
getSupDepts(deptId) {
|
||||
var number = parseFloat(deptId)
|
||||
getDeptSuperior(number).then(res => {
|
||||
const date = res.content
|
||||
this.buildDepts(date)
|
||||
this.depts = date
|
||||
})
|
||||
},
|
||||
buildDepts(depts) {
|
||||
debugger
|
||||
depts.forEach(data => {
|
||||
if (data.children) {
|
||||
this.buildDepts(data.children)
|
||||
}
|
||||
if (data.hasChildren && !data.children) {
|
||||
data.children = null
|
||||
}
|
||||
})
|
||||
},
|
||||
// 获取弹窗内部门数据
|
||||
loadDepts({ action, parentNode, callback }) {
|
||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
|
||||
parentNode.children = res.content.map(function(obj) {
|
||||
if (obj.hasChildren) {
|
||||
obj.children = null
|
||||
}
|
||||
return obj
|
||||
})
|
||||
setTimeout(() => {
|
||||
callback()
|
||||
}, 200)
|
||||
})
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.afterToEdit]() {
|
||||
// 获取入库单明细
|
||||
sparePart.getIODtl({ 'bill_code': this.form.bill_code }).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)
|
||||
}
|
||||
})
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
// 提交前校验
|
||||
if (this.form.tableData.length === 0) {
|
||||
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||
if (!this.form.tableData[i].edit) {
|
||||
this.crud.notify('尚有未完成编辑的物料明细序号' + (i + 1) + ',请检查!')
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
billTypeChange(val) {
|
||||
this.form.tableData = []
|
||||
this.form.total_qty = 0
|
||||
this.form.detail_count = 0
|
||||
},
|
||||
tableChanged2(row) {
|
||||
debugger
|
||||
// 新增一行物料时,给行进行赋值
|
||||
this.nowrow.material_code = row.material_code
|
||||
this.nowrow.material_id = row.material_id
|
||||
this.nowrow.material_name = row.material_name
|
||||
this.nowrow.material_spec = row.material_spec
|
||||
this.nowrow.material_model = row.material_model
|
||||
this.nowrow.qty_unit_id = row.qty_unit_id
|
||||
this.nowrow.qty_unit_name = row.qty_unit_name
|
||||
this.nowrow.sum_qty = row.sum_qty
|
||||
this.form.tableData.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
|
||||
},
|
||||
tableChanged(row) {
|
||||
this.form.device_id = row.devicerecord_id
|
||||
this.form.device_code = row.device_code
|
||||
this.form.device_name = row.device_name
|
||||
},
|
||||
async queryMater(index, row) {
|
||||
this.materShow = true
|
||||
this.nowindex = index
|
||||
this.nowrow = row
|
||||
},
|
||||
async insertdtl() {
|
||||
if (this.form.bill_type == '') {
|
||||
this.crud.notify('请选择业务类型!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
this.form.tableData.push({ edit: false, plan_qty: '0' })
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
handleEdit(index, row) {
|
||||
if (!row.edit) {
|
||||
if (parseFloat(row.plan_qty) <= 0) {
|
||||
this.crud.notify('数量不可为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
|
||||
if (parseFloat(row.plan_qty) > parseFloat(row.sum_qty)) {
|
||||
this.crud.notify('出库数量不能大于库存!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return false
|
||||
}
|
||||
}
|
||||
// 修改行的编辑状态
|
||||
row.edit = !row.edit
|
||||
this.form.tableData.splice(index, 1, row) // 通过splice 替换数据 触发视图更新
|
||||
if (row.edit) {
|
||||
this.form.total_qty = 0
|
||||
this.form.tableData.forEach((item) => {
|
||||
this.form.total_qty = this.form.total_qty + item.plan_qty
|
||||
})
|
||||
}
|
||||
},
|
||||
deleteRow(index, rows) {
|
||||
this.form.total_qty = parseFloat(this.form.total_qty) - parseFloat(rows[index].plan_qty)
|
||||
rows.splice(index, 1)
|
||||
this.form.detail_count = this.form.tableData.length
|
||||
},
|
||||
close() {
|
||||
this.$emit('AddChanged')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.crud-opts2 {
|
||||
padding: 4px 0;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.crud-opts2 .crud-opts-right2 {
|
||||
margin-left: auto;
|
||||
}
|
||||
</style>
|
||||
359
mes/qd/src/views/wms/sb/scrap/index.vue
Normal file
359
mes/qd/src/views/wms/sb/scrap/index.vue
Normal file
@@ -0,0 +1,359 @@
|
||||
<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.stor_id"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="全部"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storlist"
|
||||
:key="item.stor_id"
|
||||
:label="item.stor_name"
|
||||
:value="item.stor_id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="创建时间">
|
||||
<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>
|
||||
<el-form-item label="业务人员">
|
||||
<el-input
|
||||
v-model="query.bizperson"
|
||||
size="mini"
|
||||
clearable
|
||||
placeholder="业务人员"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</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 billtypelist"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<rrOperation/>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission">
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="warning"
|
||||
:disabled="dis_flag"
|
||||
icon="el-icon-check"
|
||||
size="mini"
|
||||
@click="confirm"
|
||||
>
|
||||
审核
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
highlight-current-row
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
@current-change="handleCurrentChange"
|
||||
@select="handleSelectionChange"
|
||||
@select-all="onSelectAll"
|
||||
>
|
||||
<el-table-column type="selection" width="55"/>
|
||||
<el-table-column
|
||||
label="操作"
|
||||
width="115"
|
||||
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 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" prop="bill_status" label="单据状态"/>
|
||||
<el-table-column prop="stor_name" label="仓库"/>
|
||||
<el-table-column
|
||||
show-overflow-tooltip
|
||||
prop="bill_type"
|
||||
width="100"
|
||||
:formatter="bill_typeFormat"
|
||||
label="业务类型"
|
||||
/>
|
||||
<el-table-column show-overflow-tooltip width="135" prop="biz_date" label="业务日期"/>
|
||||
<el-table-column show-overflow-tooltip prop="create_mode" :formatter="create_modeFormat" label="生成方式"/>
|
||||
<el-table-column label="明细数" align="center" prop="detail_count"/>
|
||||
<el-table-column label="总重量" align="center" prop="total_qty">
|
||||
<template slot-scope="scope">
|
||||
{{ fun(scope.row.total_qty) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark"/>
|
||||
<el-table-column label="制单人" align="center" prop="input_optname"/>
|
||||
<el-table-column label="制单时间" align="center" prop="input_time" width="150"/>
|
||||
<el-table-column label="修改人" align="center" prop="update_optname"/>
|
||||
<el-table-column label="修改时间" align="center" prop="update_time" width="150"/>
|
||||
<el-table-column label="分配人" align="center" prop="dis_optname"/>
|
||||
<el-table-column label="分配时间" align="center" prop="dis_time" width="150"/>
|
||||
<el-table-column label="确认人" align="center" prop="confirm_optname" width="150"/>
|
||||
<el-table-column label="确认时间" align="center" prop="confirm_time" width="150"/>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination/>
|
||||
</div>
|
||||
<AddDialog @AddChanged="querytable"/>
|
||||
<ViewDialog :dialog-show.sync="viewShow" :rowmst="mstrow" @AddChanged="querytable"/>
|
||||
<DivDialog :dialog-show.sync="divShow" :open-param="openParam" :bill-type="billType" :buss-config="bussConfig" @AddChanged="querytable"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sparePart from '@/api/wms/sb/sparepartout'
|
||||
import crudRawAssist from '@/api/wms/st/core/inbill/rawassist'
|
||||
import CRUD, { crud, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import ViewDialog from '@/views/wms/sb/inbill/ViewDialog'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import DateRangePicker from '@/components/DateRangePicker/index'
|
||||
import AddDialog from '@/views/wms/sb/scrap/AddDialog'
|
||||
import DivDialog from '@/views/wms/sb/outbill/DivDialog'
|
||||
import { mapGetters } from 'vuex'
|
||||
import crudStorattr from '@/api/wms/basedata/st/storattr'
|
||||
|
||||
export default {
|
||||
name: 'Handle',
|
||||
components: {
|
||||
ViewDialog,
|
||||
AddDialog,
|
||||
crudOperation,
|
||||
rrOperation,
|
||||
udOperation,
|
||||
pagination,
|
||||
DateRangePicker,
|
||||
DivDialog
|
||||
},
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '',
|
||||
optShow: { add: true, reset: true },
|
||||
idField: 'iostorinv_id',
|
||||
url: '/api/sb/inbill',
|
||||
crudMethod: { ...sparePart }
|
||||
})
|
||||
},
|
||||
mixins: [presenter(), header(), crud()],
|
||||
// 数据字典
|
||||
dicts: ['io_bill_status', 'ST_CREATE_MODE'],
|
||||
data() {
|
||||
return {
|
||||
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||
permission: {
|
||||
add: ['admin', 'user:add'],
|
||||
edit: ['admin', 'user:edit'],
|
||||
del: ['admin', 'user:del']
|
||||
},
|
||||
audit_flag: true,
|
||||
dis_flag: true,
|
||||
disShow: false,
|
||||
divShow: false,
|
||||
billType: null,
|
||||
openParam: {},
|
||||
bussConfig: null,
|
||||
currentRow: null,
|
||||
viewShow: false,
|
||||
mstrow: {},
|
||||
storlist: [],
|
||||
billtypelist: [],
|
||||
createtypelist: [],
|
||||
statuslist: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'user'
|
||||
])
|
||||
},
|
||||
mounted: function() {
|
||||
const that = this
|
||||
window.onresize = function temp() {
|
||||
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudStorattr.getStor({ 'is_attachment': '1' }).then(res => {
|
||||
this.storlist = res.content
|
||||
})
|
||||
crudRawAssist.getType({ 'io_code': '0110', 'io_flag': '01' }).then(res => {
|
||||
this.billtypelist = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
fun(val) {
|
||||
return Number(val).toFixed(3)
|
||||
},
|
||||
canUd(row) {
|
||||
return row.bill_status !== '10'
|
||||
},
|
||||
toView(index, row) {
|
||||
this.mstrow = row
|
||||
this.viewShow = true
|
||||
},
|
||||
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(currentRow) {
|
||||
if (currentRow !== null) {
|
||||
this.currentRow = currentRow
|
||||
if (currentRow.bill_status === '10' || currentRow.bill_status === '20' || currentRow.bill_status === '30' || currentRow.bill_status === '40') {
|
||||
this.dis_flag = false
|
||||
} else {
|
||||
this.dis_flag = true
|
||||
}
|
||||
}
|
||||
},
|
||||
handleCurrentChange(currentRow) {
|
||||
if (currentRow === null) {
|
||||
this.dis_flag = true
|
||||
this.currentRow = {}
|
||||
}
|
||||
},
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
this.crud.query.buss_type = '0110'
|
||||
this.handleCurrentChange(null)
|
||||
},
|
||||
bill_typeFormat(row, column) {
|
||||
for (const item of this.billtypelist) {
|
||||
if (item.code == row.bill_type) {
|
||||
return item.name
|
||||
}
|
||||
}
|
||||
},
|
||||
stateFormat(row, column) {
|
||||
return this.dict.label.io_bill_status[row.bill_status]
|
||||
},
|
||||
create_modeFormat(row, column) {
|
||||
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
||||
},
|
||||
confirm() {
|
||||
if (!this.currentRow) {
|
||||
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
sparePart.confirm(this.currentRow).then(res => {
|
||||
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
divOpen() {
|
||||
if (!this.currentRow) {
|
||||
this.crud.notify('请选择一条单据', CRUD.NOTIFICATION_TYPE.INFO)
|
||||
return
|
||||
}
|
||||
sparePart.getIODtl({ 'bill_code': this.currentRow.bill_code, 'open_flag': '1' }).then(res => {
|
||||
this.openParam = res
|
||||
this.billType = this.currentRow.bill_type
|
||||
this.divShow = true
|
||||
})
|
||||
},
|
||||
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>
|
||||
Reference in New Issue
Block a user