rev:新增原材料需求功能
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
package org.nl.common.domain;
|
package org.nl.common.domain;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public
|
public
|
||||||
interface LockProcess {
|
interface LockProcess {
|
||||||
void process();
|
void process() throws IOException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,28 @@
|
|||||||
package org.nl.wms.pcs_manage.controller.purchase;
|
package org.nl.wms.pcs_manage.controller.purchase;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.nl.common.TableDataInfo;
|
|
||||||
import org.nl.common.anno.Log;
|
import org.nl.common.anno.Log;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.wms.masterdata_manage.storage.service.storage.dao.StIvtStructattr;
|
import org.nl.common.utils.RedissonUtils;
|
||||||
|
import org.nl.common.utils.SecurityUtils;
|
||||||
|
import org.nl.wms.pcs_manage.PCSEnum;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -40,5 +46,76 @@ public class PcsIfPurchaseorderController {
|
|||||||
return new ResponseEntity<>(purchaseorderService.queryRawIn(query, page), HttpStatus.OK);
|
return new ResponseEntity<>(purchaseorderService.queryRawIn(query, page), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
@Log("原料需求分页查询")
|
||||||
|
@ApiOperation("原料需求分页查询")
|
||||||
|
public ResponseEntity<Object> pageQuery(PurchaseOrderQuery query, PageQuery page) {
|
||||||
|
return new ResponseEntity<>(purchaseorderService.pageQuery(query, page), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Log("新增原料需求")
|
||||||
|
@ApiOperation("新增原料需求")
|
||||||
|
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
|
||||||
|
purchaseorderService.create(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
@Log("修改原料需求")
|
||||||
|
@ApiOperation("修改原料需求")
|
||||||
|
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
|
||||||
|
purchaseorderService.update(whereJson);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/commit")
|
||||||
|
@Log("提交原料需求")
|
||||||
|
@ApiOperation("提交原料需求")
|
||||||
|
public ResponseEntity<Object> commit(@RequestBody List<PcsIfPurchaseorder> list) {
|
||||||
|
list.forEach(order -> {
|
||||||
|
order.setStatus(PCSEnum.BILL_STATUS.code("提交"));
|
||||||
|
order.setAudit_id(SecurityUtils.getCurrentUserId());
|
||||||
|
order.setAudit_name(SecurityUtils.getCurrentNickName());
|
||||||
|
order.setAudit_time(DateUtil.now());
|
||||||
|
purchaseorderService.updateById(order);
|
||||||
|
});
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getDtl")
|
||||||
|
@Log("获取原料需求明细")
|
||||||
|
@ApiOperation("获取原料需求明细")
|
||||||
|
public ResponseEntity<Object> getDtl(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(purchaseorderService.getDtl(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@Log("删除原料需求")
|
||||||
|
@ApiOperation("删除原料需求")
|
||||||
|
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||||
|
for (Long id : ids) {
|
||||||
|
purchaseorderService.update(new UpdateWrapper<PcsIfPurchaseorder>().eq("id", id).set("is_delete", true));
|
||||||
|
}
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Log("导出数据")
|
||||||
|
@ApiOperation("导出数据")
|
||||||
|
@GetMapping(value = "/download")
|
||||||
|
public void download(PurchaseOrderQuery query, HttpServletResponse response) throws IOException {
|
||||||
|
purchaseorderService.download(query, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/excelImport")
|
||||||
|
@Log("excel导入")
|
||||||
|
@ApiOperation("excel导入")
|
||||||
|
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
RedissonUtils.lock(() -> {
|
||||||
|
purchaseorderService.excelImport(file, request, response);
|
||||||
|
}, "原料需求导入", null);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ import org.nl.common.domain.query.PageQuery;
|
|||||||
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||||
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
import org.nl.wms.storage_manage.rawmanage.service.iostorInv.dto.YlIostorInvQuery;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -25,6 +31,8 @@ public interface IPcsIfPurchaseorderService extends IService<PcsIfPurchaseorder>
|
|||||||
*/
|
*/
|
||||||
Object queryRawIn(PurchaseOrderQuery query, PageQuery page);
|
Object queryRawIn(PurchaseOrderQuery query, PageQuery page);
|
||||||
|
|
||||||
|
Object pageQuery(PurchaseOrderQuery query, PageQuery page);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改原料需求表的入库数量并修改状态
|
* 修改原料需求表的入库数量并修改状态
|
||||||
*
|
*
|
||||||
@@ -32,4 +40,15 @@ public interface IPcsIfPurchaseorderService extends IService<PcsIfPurchaseorder>
|
|||||||
*/
|
*/
|
||||||
void updatePurchaseNum(JSONObject jo);
|
void updatePurchaseNum(JSONObject jo);
|
||||||
|
|
||||||
|
List<PcsIfPurchaseorder> getDtl(JSONObject jo);
|
||||||
|
|
||||||
|
void create(JSONObject form);
|
||||||
|
|
||||||
|
void download(PurchaseOrderQuery query, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
void update(JSONObject form);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,12 @@ public class PcsIfPurchaseorder implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
private String STATUS;
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成方式
|
||||||
|
*/
|
||||||
|
private String create_mode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建人
|
* 创建人
|
||||||
@@ -126,6 +131,21 @@ public class PcsIfPurchaseorder implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String audit_name;
|
private String audit_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购人
|
||||||
|
*/
|
||||||
|
private String purchase_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购人时间
|
||||||
|
*/
|
||||||
|
private String purchase_time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购人姓名
|
||||||
|
*/
|
||||||
|
private String purchase_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 确认人
|
* 确认人
|
||||||
*/
|
*/
|
||||||
@@ -151,6 +171,11 @@ public class PcsIfPurchaseorder implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Boolean is_delete;
|
private Boolean is_delete;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 部门ID
|
||||||
|
*/
|
||||||
|
private String material_code;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门ID
|
* 部门ID
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -21,4 +21,5 @@ import java.util.Map;
|
|||||||
public interface PcsIfPurchaseorderMapper extends BaseMapper<PcsIfPurchaseorder> {
|
public interface PcsIfPurchaseorderMapper extends BaseMapper<PcsIfPurchaseorder> {
|
||||||
|
|
||||||
List<Map> getMstDetail(@Param("query") PurchaseOrderQuery query, @Param(value = "pageQuery") PageQuery pageQuery);
|
List<Map> getMstDetail(@Param("query") PurchaseOrderQuery query, @Param(value = "pageQuery") PageQuery pageQuery);
|
||||||
|
List<Map> queryAll(@Param("query") PurchaseOrderQuery query, @Param(value = "pageQuery") PageQuery pageQuery);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,4 +29,37 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="queryAll" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
po.*,
|
||||||
|
mb.material_code,
|
||||||
|
mb.material_name,
|
||||||
|
class.class_name
|
||||||
|
FROM
|
||||||
|
pcs_if_purchaseorder po
|
||||||
|
LEFT JOIN md_me_materialbase mb ON mb.material_id = po.material_id
|
||||||
|
LEFT JOIN md_pb_classstandard class ON class.class_id = mb.material_type_id
|
||||||
|
<where>
|
||||||
|
po.is_delete = '0'
|
||||||
|
<if test="query.status == '0'.toString()">
|
||||||
|
and po.status = '10'
|
||||||
|
</if>
|
||||||
|
<if test="query.status == '1'.toString()">
|
||||||
|
and po.status > '10'
|
||||||
|
</if>
|
||||||
|
<if test="query.start_time != null">
|
||||||
|
and po.ask_time >= #{query.start_time}
|
||||||
|
</if>
|
||||||
|
<if test="query.end_time != null">
|
||||||
|
and #{query.end_time} >= po.ask_time
|
||||||
|
</if>
|
||||||
|
<if test="query.bill_code != null and query.bill_code != ''">
|
||||||
|
and mst.bill_code = #{query.bill_code}
|
||||||
|
</if>
|
||||||
|
<if test="query.material_search != null and query.material_search != ''">
|
||||||
|
and (mb.material_code = #{query.material_search} OR mb.material_name = #{query.material_search})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -16,16 +16,12 @@ public class PurchaseOrderQuery extends BaseQuery<PcsIfPurchaseorder> {
|
|||||||
|
|
||||||
private String bill_code;
|
private String bill_code;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
private String material_search;
|
private String material_search;
|
||||||
|
|
||||||
private Boolean is_delete = false;
|
private String create_mode;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paramMapping() {
|
|
||||||
super.doP.put("bill_code", QParam.builder().k(new String[]{"bill_code"}).type(QueryTEnum.LK).build());
|
|
||||||
super.doP.put("material_search", QParam.builder().k(new String[]{"material_search"}).type(QueryTEnum.LK).build());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private String workshop_id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package org.nl.wms.pcs_manage.service.purchase.impl;
|
package org.nl.wms.pcs_manage.service.purchase.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelReader;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
@@ -10,19 +15,27 @@ import com.github.pagehelper.Page;
|
|||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import org.nl.common.TableDataInfo;
|
import org.nl.common.TableDataInfo;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
|
import org.nl.common.utils.IdUtil;
|
||||||
import org.nl.common.utils.SecurityUtils;
|
import org.nl.common.utils.SecurityUtils;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
|
import org.nl.modules.common.utils.FileUtil;
|
||||||
|
import org.nl.modules.tools.service.dto.LocalStorageDto;
|
||||||
import org.nl.wms.pcs_manage.PCSEnum;
|
import org.nl.wms.pcs_manage.PCSEnum;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
import org.nl.wms.pcs_manage.service.purchase.IPcsIfPurchaseorderService;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
import org.nl.wms.pcs_manage.service.purchase.dao.PcsIfPurchaseorder;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.dao.mapper.PcsIfPurchaseorderMapper;
|
import org.nl.wms.pcs_manage.service.purchase.dao.mapper.PcsIfPurchaseorderMapper;
|
||||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||||
|
import org.nl.wms.storage_manage.CHECKEnum;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -48,6 +61,79 @@ public class PcsIfPurchaseorderServiceImpl extends ServiceImpl<PcsIfPurchaseorde
|
|||||||
return build;
|
return build;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object pageQuery(PurchaseOrderQuery query, PageQuery pageQuery) {
|
||||||
|
Page<Object> page = PageHelper.startPage(pageQuery.getPage() + 1, pageQuery.getSize());
|
||||||
|
List<Map> mst_detail = purchaseorderMapper.queryAll(query, pageQuery);
|
||||||
|
TableDataInfo<Map> build = TableDataInfo.build(mst_detail);
|
||||||
|
build.setTotalElements(page.getTotal());
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PcsIfPurchaseorder> getDtl(JSONObject jo) {
|
||||||
|
String material_id = jo.getString("material_id");
|
||||||
|
return this.list(new QueryWrapper<PcsIfPurchaseorder>().eq("material_id", material_id).eq("status", PCSEnum.BILL_STATUS.code("生成")).eq("is_delete", false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(JSONObject form) {
|
||||||
|
JSONArray rows = form.getJSONArray("tableData");
|
||||||
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
|
JSONObject row = rows.getJSONObject(i);
|
||||||
|
PcsIfPurchaseorder purchase = row.toJavaObject(PcsIfPurchaseorder.class);
|
||||||
|
this.updateById(purchase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void download(PurchaseOrderQuery query, HttpServletResponse response) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
List<Map> mst_detail = purchaseorderMapper.queryAll(query, null);
|
||||||
|
for (Map dtl : mst_detail) {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("id(不可修改)", dtl.get("id"));
|
||||||
|
map.put("车间", dtl.get("workshop_id"));
|
||||||
|
map.put("物料编码", dtl.get("material_code"));
|
||||||
|
map.put("物料名称", dtl.get("material_name"));
|
||||||
|
map.put("数量", dtl.get("qty"));
|
||||||
|
map.put("单位", dtl.get("qty_unit_name"));
|
||||||
|
map.put("要求到料日期", dtl.get("ask_time"));
|
||||||
|
map.put("订单编号", dtl.get("po_code"));
|
||||||
|
map.put("确认到料日期", dtl.get("agree_time"));
|
||||||
|
map.put("入库数量", dtl.get("instor_qty"));
|
||||||
|
map.put("状态", dtl.get("status"));
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(JSONObject form) {
|
||||||
|
JSONArray rows = form.getJSONArray("tableData");
|
||||||
|
for (int i = 0; i < rows.size(); i++) {
|
||||||
|
JSONObject row = rows.getJSONObject(i);
|
||||||
|
PcsIfPurchaseorder order = new PcsIfPurchaseorder();
|
||||||
|
order.setId(IdUtil.getStringId());
|
||||||
|
order.setWorkshop_id(form.getString("workshop_id"));
|
||||||
|
order.setMaterial_id(form.getString("material_id"));
|
||||||
|
order.setMaterial_code(form.getString("material_code"));
|
||||||
|
order.setQty(row.getBigDecimal("qty"));
|
||||||
|
order.setStatus(PCSEnum.BILL_STATUS.code("生成"));
|
||||||
|
order.setQty_unit_id(form.getString("qty_unit_id"));
|
||||||
|
order.setQty_unit_name(form.getString("qty_unit_name"));
|
||||||
|
order.setAsk_time(row.getString("ask_time"));
|
||||||
|
order.setCreate_mode(CHECKEnum.CREATE_MODE.code("PC产生"));
|
||||||
|
order.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||||
|
order.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||||
|
order.setCreate_time(DateUtil.now());
|
||||||
|
order.setIs_delete(false);
|
||||||
|
order.setSyscompanyid("111");
|
||||||
|
order.setSysdeptid("111");
|
||||||
|
this.save(order);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePurchaseNum(JSONObject jo) {
|
public void updatePurchaseNum(JSONObject jo) {
|
||||||
String po_code = jo.getString("po_code");
|
String po_code = jo.getString("po_code");
|
||||||
@@ -60,20 +146,55 @@ public class PcsIfPurchaseorderServiceImpl extends ServiceImpl<PcsIfPurchaseorde
|
|||||||
}
|
}
|
||||||
PcsIfPurchaseorder purchaseorder = this.getOne(new QueryWrapper<PcsIfPurchaseorder>().eq("po_code", po_code));
|
PcsIfPurchaseorder purchaseorder = this.getOne(new QueryWrapper<PcsIfPurchaseorder>().eq("po_code", po_code));
|
||||||
|
|
||||||
if (purchaseorder.getSTATUS().equals(PCSEnum.BILL_STATUS.code("完成"))) {
|
if (purchaseorder.getStatus().equals(PCSEnum.BILL_STATUS.code("完成"))) {
|
||||||
throw new BadRequestException("当前单据状态已经完成,无法进行入库数修改!");
|
throw new BadRequestException("当前单据状态已经完成,无法进行入库数修改!");
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal new_instor_qty = NumberUtil.add(instor_qty, purchaseorder.getInstor_qty(), 3);
|
BigDecimal new_instor_qty = NumberUtil.add(instor_qty, purchaseorder.getInstor_qty(), 3);
|
||||||
purchaseorder.setQty(new_instor_qty);
|
purchaseorder.setQty(new_instor_qty);
|
||||||
if (purchaseorder.getTotal_qty().compareTo(new_instor_qty) <= 0) {
|
if (purchaseorder.getTotal_qty().compareTo(new_instor_qty) <= 0) {
|
||||||
purchaseorder.setSTATUS(PCSEnum.BILL_STATUS.code("完成"));
|
purchaseorder.setStatus(PCSEnum.BILL_STATUS.code("完成"));
|
||||||
purchaseorder.setConfirm_id(SecurityUtils.getCurrentUserId());
|
purchaseorder.setConfirm_id(SecurityUtils.getCurrentUserId());
|
||||||
purchaseorder.setConfirm_name(SecurityUtils.getCurrentNickName());
|
purchaseorder.setConfirm_name(SecurityUtils.getCurrentNickName());
|
||||||
purchaseorder.setConfirm_time(DateUtil.now());
|
purchaseorder.setConfirm_time(DateUtil.now());
|
||||||
} else {
|
} else {
|
||||||
purchaseorder.setSTATUS(PCSEnum.BILL_STATUS.code("到货中"));
|
purchaseorder.setStatus(PCSEnum.BILL_STATUS.code("到货中"));
|
||||||
}
|
}
|
||||||
this.updateById(purchaseorder);
|
this.updateById(purchaseorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
InputStream inputStream = file.getInputStream();
|
||||||
|
ExcelReader excelReader = ExcelUtil.getReader(inputStream);
|
||||||
|
List<List<Object>> read = excelReader.read();
|
||||||
|
|
||||||
|
for (int i = 1; i < read.size(); i++) {
|
||||||
|
List<Object> list = read.get(i);
|
||||||
|
if (ObjectUtil.isEmpty(list)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String id = (String) list.get(0);
|
||||||
|
String po_code = (String) list.get(7);
|
||||||
|
String agree_time = ((DateTime) list.get(8)).toString("YYYY-MM-dd");
|
||||||
|
String status = (String) list.get(10);
|
||||||
|
PcsIfPurchaseorder order = this.getOne(new QueryWrapper<PcsIfPurchaseorder>().eq("id", id));
|
||||||
|
if (ObjectUtil.isEmpty(order)) {
|
||||||
|
throw new BadRequestException("未查询到第" + (i + 1) + "行的原料需求!");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (status.equals(PCSEnum.BILL_STATUS.code("提交"))) {
|
||||||
|
order.setPo_code(po_code);
|
||||||
|
order.setAgree_time(agree_time);
|
||||||
|
order.setStatus(PCSEnum.BILL_STATUS.code("确认采购"));
|
||||||
|
order.setPurchase_id("0");
|
||||||
|
order.setPurchase_name("EXCEL导入");
|
||||||
|
order.setPurchase_time(DateUtil.now());
|
||||||
|
this.updateById(order);
|
||||||
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
throw new BadRequestException("第" + (i + 1) + "行输入的数据有误!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ import DateRangePicker from '@/components/DateRangePicker/index'
|
|||||||
import crudSap from '@/api/wms/ext/sap'
|
import crudSap from '@/api/wms/ext/sap'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'importOrder',
|
name: 'ImportOrder',
|
||||||
components: {rrOperation, pagination, DateRangePicker},
|
components: {rrOperation, pagination, DateRangePicker},
|
||||||
cruds() {
|
cruds() {
|
||||||
},
|
},
|
||||||
|
|||||||
318
mes/qd/src/views/wms/pcs/purchaseorder/AddDialog.vue
Normal file
318
mes/qd/src/views/wms/pcs/purchaseorder/AddDialog.vue
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
<!--suppress ALL -->
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="crud.status.title"
|
||||||
|
append-to-body
|
||||||
|
fullscreen
|
||||||
|
: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="workshop_id">
|
||||||
|
<label slot="label">车间</label>
|
||||||
|
<el-select
|
||||||
|
v-model="form.workshop_id"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="全部"
|
||||||
|
class="filter-item"
|
||||||
|
>
|
||||||
|
<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="material_code">
|
||||||
|
<el-input v-model.trim="form.material_code" disabled class="input-with-select" style="width: 370px;">
|
||||||
|
<el-button slot="append" icon="el-icon-search" @click="insertEvent"/>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料名称" prop="material_name">
|
||||||
|
<label slot="label">物料名称:</label>
|
||||||
|
<el-input v-model="form.material_name" size="mini" disabled 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.number="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="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
v-if="crud.status.add > 0"
|
||||||
|
size="mini"
|
||||||
|
@click="add"
|
||||||
|
>
|
||||||
|
新增一行
|
||||||
|
</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="物料编码"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="ask_time" label="要求到货日期" style="width: 250px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.tableData[scope.$index].ask_time"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
align="center"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
:disabled="crud.status.view > 0"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column show-overflow-tooltip prop="qty" label="需求数量">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input-number
|
||||||
|
v-model.number="form.tableData[scope.$index].qty"
|
||||||
|
size="small"
|
||||||
|
:controls="false"
|
||||||
|
controls-position="right"
|
||||||
|
:precision="3"
|
||||||
|
:min="0"
|
||||||
|
@change="changeQty"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column show-overflow-tooltip prop="safe_qty" label="安全库存"/>-->
|
||||||
|
<!-- <el-table-column show-overflow-tooltip prop="remark" label="总需求数量"/>-->
|
||||||
|
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="数量单位"/>
|
||||||
|
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="100" 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>
|
||||||
|
|
||||||
|
<MaterDtl
|
||||||
|
:dialog-show.sync="materShow"
|
||||||
|
:is-single="true"
|
||||||
|
@setMaterValue="tableChanged"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CRUD, {crud, form} from '@crud/crud'
|
||||||
|
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||||
|
import crudPurchase from '@/views/wms/pcs/purchaseorder/purchase'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
product_code: '',
|
||||||
|
status: '10',
|
||||||
|
create_mode: '01',
|
||||||
|
material_code: '',
|
||||||
|
material_name: '',
|
||||||
|
qty_unit_id: '',
|
||||||
|
qty_unit_name: '',
|
||||||
|
total_qty: 0,
|
||||||
|
detail_count: '0',
|
||||||
|
workshop_id: '',
|
||||||
|
tableData: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AddDialog',
|
||||||
|
components: {MaterDtl},
|
||||||
|
mixins: [crud(), form(defaultForm)],
|
||||||
|
dicts: ['IO_BILL_STATUS', 'ST_INV_RAW_IN_TYPE', 'ST_QUALITY_SCODE', 'bill_type', 'product_area'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
materShow: false,
|
||||||
|
billShow: false,
|
||||||
|
struct_id: '',
|
||||||
|
sect_id: '',
|
||||||
|
opendtlParam: null,
|
||||||
|
sects: [],
|
||||||
|
rules: {
|
||||||
|
product_code: [
|
||||||
|
{required: true, message: '生产车间不能为空', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
bill_type: [
|
||||||
|
{required: true, message: '业务类型不能为空', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
biz_date: [
|
||||||
|
{required: true, message: '业务日期不能为空', trigger: 'blur'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
|
this.$emit('AddChanged')
|
||||||
|
},
|
||||||
|
[CRUD.HOOK.beforeToEdit]() {
|
||||||
|
crudPurchase.getDtl(this.form).then(res => {
|
||||||
|
for (let i = 0; i < res.length; i++) {
|
||||||
|
const row = res[i]
|
||||||
|
row.material_name = this.form.material_name
|
||||||
|
}
|
||||||
|
this.form.tableData = res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
[CRUD.HOOK.beforeSubmit]() {
|
||||||
|
// 提交前校验
|
||||||
|
if (this.form.tableData.length === 0) {
|
||||||
|
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.form.workshop_id) {
|
||||||
|
this.crud.notify('车间不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||||
|
const row = this.form.tableData[i]
|
||||||
|
if (!row.qty || row.qty === 0) {
|
||||||
|
this.crud.notify('数量不能为0', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteRow(index, rows) {
|
||||||
|
const material_code = rows[index].material_code
|
||||||
|
let len = rows.length
|
||||||
|
while (len--) {
|
||||||
|
const obj = rows[len]
|
||||||
|
if (material_code === obj.material_code) {
|
||||||
|
const index = rows.indexOf(obj)
|
||||||
|
if (index > -1) { // 移除找到的指定元素
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tableChanged(item) {
|
||||||
|
this.form.qty_unit_id = item.base_unit_id
|
||||||
|
this.form.qty_unit_name = item.base_unit_name
|
||||||
|
this.form.material_code = item.material_code
|
||||||
|
this.form.material_name = item.material_name
|
||||||
|
this.form.material_id = item.material_id
|
||||||
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(row.plan_qty)
|
||||||
|
},
|
||||||
|
add() {
|
||||||
|
if (!this.form.material_code){
|
||||||
|
this.crud.notify('请选择一种物料进行新增!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const row = {}
|
||||||
|
row.material_code = this.form.material_code
|
||||||
|
row.material_name = this.form.material_name
|
||||||
|
row.qty_unit_name = this.form.qty_unit_name
|
||||||
|
this.$set(row,'ask_time',null)
|
||||||
|
this.$set(row,'qty',null)
|
||||||
|
this.form.tableData.splice(-1, 0, row)
|
||||||
|
},
|
||||||
|
insertEvent() {
|
||||||
|
this.materShow = true
|
||||||
|
},
|
||||||
|
insertBill(row) {
|
||||||
|
this.billShow = true
|
||||||
|
},
|
||||||
|
changeQty() {
|
||||||
|
this.form.total_qty = 0
|
||||||
|
this.form.tableData.forEach((item) => {
|
||||||
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.crud-opts2 {
|
||||||
|
padding: 4px 0;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crud-opts2 .crud-opts-right2 {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
254
mes/qd/src/views/wms/pcs/purchaseorder/index.vue
Normal file
254
mes/qd/src/views/wms/pcs/purchaseorder/index.vue
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
<!--suppress ALL -->
|
||||||
|
<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-select
|
||||||
|
v-model="query.workshop_id"
|
||||||
|
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-date-picker
|
||||||
|
v-model="query.createTime"
|
||||||
|
type="daterange"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
align="center"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
@change="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.create_mode"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
size="mini"
|
||||||
|
placeholder="生成方式"
|
||||||
|
class="filter-item"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.ST_INV_CREATE"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料">
|
||||||
|
<el-input
|
||||||
|
v-model="query.material_search"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="编码、名称"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<rrOperation />
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="warning"
|
||||||
|
icon="el-icon-check"
|
||||||
|
:disabled="crud.selections.length === 0"
|
||||||
|
size="mini"
|
||||||
|
@click="commit(crud.selections)"
|
||||||
|
>
|
||||||
|
提交采购
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
size="mini"
|
||||||
|
:data="crud.data"
|
||||||
|
highlight-current-row
|
||||||
|
show-summary
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
style="width: 100%;"
|
||||||
|
@select-all="crud.selectAllChange"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="workshop_id" label="车间" />
|
||||||
|
<el-table-column show-overflow-tooltip prop="material_code" width="130" label="物料编号"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="material_name" width="130" label="物料名称"/>
|
||||||
|
<el-table-column prop="ask_time" label="要求到货日期" width="130" show-overflow-tooltip />
|
||||||
|
<el-table-column show-overflow-tooltip prop="qty" min-width="120" label="重量"/>
|
||||||
|
<!-- <el-table-column show-overflow-tooltip min-width="120" prop="biz_date" label="安全库存" />-->
|
||||||
|
<!-- <el-table-column label="总重量" align="center" prop="total_qty"/>-->
|
||||||
|
<el-table-column label="状态" align="center" prop="status" :formatter="stateFormat"/>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark" />
|
||||||
|
<el-table-column label="生成方式" align="center" prop="create_mode" :formatter="createModeFormat"/>
|
||||||
|
<el-table-column label="创建人" align="center" prop="create_name" width="150" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="create_time" width="150" />
|
||||||
|
<el-table-column label="提交人" align="center" prop="audit_namne" width="150" />
|
||||||
|
<el-table-column label="提交时间" align="center" prop="audit_time" width="140px" />
|
||||||
|
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination />
|
||||||
|
</div>
|
||||||
|
<AddDialog @AddChanged="querytable" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudPurchase from '@/views/wms/pcs/purchaseorder/purchase'
|
||||||
|
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 DateRangePicker from '@/components/DateRangePicker/index'
|
||||||
|
import AddDialog from '@/views/wms/pcs/purchaseorder/AddDialog'
|
||||||
|
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchaseOrder',
|
||||||
|
components: { AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker },
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '',
|
||||||
|
optShow: { add: true, reset: true },
|
||||||
|
idField: 'id',
|
||||||
|
query: {
|
||||||
|
'status': '0'
|
||||||
|
},
|
||||||
|
url: '/api/pcsIfPurchaseorder',
|
||||||
|
crudMethod: { ...crudPurchase }
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mixins: [presenter(), header(), crud()],
|
||||||
|
// 数据字典
|
||||||
|
dicts: ['PURCHASE_STATUS', 'product_area', 'ST_CREATE_MODE'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||||
|
permission: {},
|
||||||
|
disShow: false,
|
||||||
|
viewShow: false,
|
||||||
|
mstrow: {},
|
||||||
|
divShow: false,
|
||||||
|
openParam: [],
|
||||||
|
currentRow: null,
|
||||||
|
storlist: [],
|
||||||
|
storId: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted: function() {
|
||||||
|
const that = this
|
||||||
|
window.onresize = function temp() {
|
||||||
|
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
crudStorattr.getStor({ 'stor_type': '3' }).then(res => {
|
||||||
|
this.storlist = res.content
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getSummaries(param) {
|
||||||
|
const { columns, data } = param;
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = '合计';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const values = data.map(item => Number(item[column.property]));
|
||||||
|
if (column.property === 'qty') {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr);
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return prev + curr;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
sums[index] += ' KG';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
bill_typeFormat(row, column) {
|
||||||
|
return this.dict.label.ST_INV_RAW_IN_TYPE[row.bill_type]
|
||||||
|
},
|
||||||
|
commit(rows) {
|
||||||
|
crudPurchase.commit(rows).then(res => {
|
||||||
|
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.crud.toQuery()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
stateFormat(row, column) {
|
||||||
|
return this.dict.label.PURCHASE_STATUS[row.status]
|
||||||
|
},
|
||||||
|
createModeFormat(row, column) {
|
||||||
|
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
||||||
|
},
|
||||||
|
querytable() {
|
||||||
|
this.onSelectAll()
|
||||||
|
this.crud.toQuery()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
::v-deep .el-dialog__body {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
67
mes/qd/src/views/wms/pcs/purchaseorder/purchase.js
Normal file
67
mes/qd/src/views/wms/pcs/purchaseorder/purchase.js
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/delete',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/update',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function confirm(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/confirm',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDtl(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/getDtl',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function commit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/commit',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function excelImport(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/excelImport',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
del,
|
||||||
|
confirm,
|
||||||
|
getDtl,
|
||||||
|
commit,
|
||||||
|
excelImport
|
||||||
|
}
|
||||||
318
mes/qd/src/views/wms/pcs/purchaseplan/AddDialog.vue
Normal file
318
mes/qd/src/views/wms/pcs/purchaseplan/AddDialog.vue
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
<!--suppress ALL -->
|
||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
:title="crud.status.title"
|
||||||
|
append-to-body
|
||||||
|
fullscreen
|
||||||
|
: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="workshop_id">
|
||||||
|
<label slot="label">车间</label>
|
||||||
|
<el-select
|
||||||
|
v-model="form.workshop_id"
|
||||||
|
clearable
|
||||||
|
size="mini"
|
||||||
|
placeholder="全部"
|
||||||
|
class="filter-item"
|
||||||
|
>
|
||||||
|
<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="material_code">
|
||||||
|
<el-input v-model.trim="form.material_code" disabled class="input-with-select" style="width: 370px;">
|
||||||
|
<el-button slot="append" icon="el-icon-search" @click="insertEvent"/>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料名称" prop="material_name">
|
||||||
|
<label slot="label">物料名称:</label>
|
||||||
|
<el-input v-model="form.material_name" size="mini" disabled 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.number="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="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
v-if="crud.status.add > 0"
|
||||||
|
size="mini"
|
||||||
|
@click="add"
|
||||||
|
>
|
||||||
|
新增一行
|
||||||
|
</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="物料编码"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="ask_time" label="要求到货日期" style="width: 250px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="form.tableData[scope.$index].ask_time"
|
||||||
|
type="date"
|
||||||
|
placeholder="选择日期"
|
||||||
|
align="center"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
:disabled="crud.status.view > 0"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column show-overflow-tooltip prop="qty" label="需求数量">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-input-number
|
||||||
|
v-model.number="form.tableData[scope.$index].qty"
|
||||||
|
size="small"
|
||||||
|
:controls="false"
|
||||||
|
controls-position="right"
|
||||||
|
:precision="3"
|
||||||
|
:min="0"
|
||||||
|
@change="changeQty"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<!-- <el-table-column show-overflow-tooltip prop="safe_qty" label="安全库存"/>-->
|
||||||
|
<!-- <el-table-column show-overflow-tooltip prop="remark" label="总需求数量"/>-->
|
||||||
|
<el-table-column show-overflow-tooltip prop="qty_unit_name" label="数量单位"/>
|
||||||
|
<el-table-column v-if="crud.status.cu > 0" align="center" label="操作" width="100" 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>
|
||||||
|
|
||||||
|
<MaterDtl
|
||||||
|
:dialog-show.sync="materShow"
|
||||||
|
:is-single="true"
|
||||||
|
@setMaterValue="tableChanged"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import CRUD, {crud, form} from '@crud/crud'
|
||||||
|
import MaterDtl from '@/views/wms/pub/MaterDialog'
|
||||||
|
import crudPurchase from '@/views/wms/pcs/purchaseorder/purchase'
|
||||||
|
|
||||||
|
const defaultForm = {
|
||||||
|
product_code: '',
|
||||||
|
status: '10',
|
||||||
|
create_mode: '01',
|
||||||
|
material_code: '',
|
||||||
|
material_name: '',
|
||||||
|
qty_unit_id: '',
|
||||||
|
qty_unit_name: '',
|
||||||
|
total_qty: 0,
|
||||||
|
detail_count: '0',
|
||||||
|
workshop_id: '',
|
||||||
|
tableData: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'AddDialog',
|
||||||
|
components: {MaterDtl},
|
||||||
|
mixins: [crud(), form(defaultForm)],
|
||||||
|
dicts: ['IO_BILL_STATUS', 'ST_INV_RAW_IN_TYPE', 'ST_QUALITY_SCODE', 'bill_type', 'product_area'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
materShow: false,
|
||||||
|
billShow: false,
|
||||||
|
struct_id: '',
|
||||||
|
sect_id: '',
|
||||||
|
opendtlParam: null,
|
||||||
|
sects: [],
|
||||||
|
rules: {
|
||||||
|
product_code: [
|
||||||
|
{required: true, message: '生产车间不能为空', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
bill_type: [
|
||||||
|
{required: true, message: '业务类型不能为空', trigger: 'blur'}
|
||||||
|
],
|
||||||
|
biz_date: [
|
||||||
|
{required: true, message: '业务日期不能为空', trigger: 'blur'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
close() {
|
||||||
|
this.$emit('AddChanged')
|
||||||
|
},
|
||||||
|
[CRUD.HOOK.beforeToEdit]() {
|
||||||
|
crudPurchase.getDtl(this.form).then(res => {
|
||||||
|
for (let i = 0; i < res.length; i++) {
|
||||||
|
const row = res[i]
|
||||||
|
row.material_name = this.form.material_name
|
||||||
|
}
|
||||||
|
this.form.tableData = res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
[CRUD.HOOK.beforeSubmit]() {
|
||||||
|
// 提交前校验
|
||||||
|
if (this.form.tableData.length === 0) {
|
||||||
|
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.form.workshop_id) {
|
||||||
|
this.crud.notify('车间不能为空!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < this.form.tableData.length; i++) {
|
||||||
|
const row = this.form.tableData[i]
|
||||||
|
if (!row.qty || row.qty === 0) {
|
||||||
|
this.crud.notify('数量不能为0', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
deleteRow(index, rows) {
|
||||||
|
const material_code = rows[index].material_code
|
||||||
|
let len = rows.length
|
||||||
|
while (len--) {
|
||||||
|
const obj = rows[len]
|
||||||
|
if (material_code === obj.material_code) {
|
||||||
|
const index = rows.indexOf(obj)
|
||||||
|
if (index > -1) { // 移除找到的指定元素
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
tableChanged(item) {
|
||||||
|
this.form.qty_unit_id = item.base_unit_id
|
||||||
|
this.form.qty_unit_name = item.base_unit_name
|
||||||
|
this.form.material_code = item.material_code
|
||||||
|
this.form.material_name = item.material_name
|
||||||
|
this.form.material_id = item.material_id
|
||||||
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(row.plan_qty)
|
||||||
|
},
|
||||||
|
add() {
|
||||||
|
if (!this.form.material_code){
|
||||||
|
this.crud.notify('请选择一种物料进行新增!', CRUD.NOTIFICATION_TYPE.INFO)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
const row = {}
|
||||||
|
row.material_code = this.form.material_code
|
||||||
|
row.material_name = this.form.material_name
|
||||||
|
row.qty_unit_name = this.form.qty_unit_name
|
||||||
|
this.$set(row,'ask_time',null)
|
||||||
|
this.$set(row,'qty',null)
|
||||||
|
this.form.tableData.splice(-1, 0, row)
|
||||||
|
},
|
||||||
|
insertEvent() {
|
||||||
|
this.materShow = true
|
||||||
|
},
|
||||||
|
insertBill(row) {
|
||||||
|
this.billShow = true
|
||||||
|
},
|
||||||
|
changeQty() {
|
||||||
|
this.form.total_qty = 0
|
||||||
|
this.form.tableData.forEach((item) => {
|
||||||
|
this.form.total_qty = parseFloat(this.form.total_qty) + parseFloat(item.plan_qty)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.crud-opts2 {
|
||||||
|
padding: 4px 0;
|
||||||
|
display: -webkit-flex;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crud-opts2 .crud-opts-right2 {
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
116
mes/qd/src/views/wms/pcs/purchaseplan/UploadDialog.vue
Normal file
116
mes/qd/src/views/wms/pcs/purchaseplan/UploadDialog.vue
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog
|
||||||
|
title="导入原料需求"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
destroy-on-close
|
||||||
|
width="400px"
|
||||||
|
:show-close="true"
|
||||||
|
@close="close"
|
||||||
|
@open="open"
|
||||||
|
>
|
||||||
|
<el-upload
|
||||||
|
ref="upload"
|
||||||
|
class="upload-demo"
|
||||||
|
action=""
|
||||||
|
drag
|
||||||
|
:on-exceed="is_one"
|
||||||
|
:limit="1"
|
||||||
|
:auto-upload="false"
|
||||||
|
:multiple="false"
|
||||||
|
:show-file-list="true"
|
||||||
|
:on-change="uploadByJsqd"
|
||||||
|
:file-list="fileList"
|
||||||
|
accept=".xlsx,.xls"
|
||||||
|
>
|
||||||
|
<i class="el-icon-upload" />
|
||||||
|
<div class="el-upload__text">
|
||||||
|
将文件拖到此处,或
|
||||||
|
<em>点击上传</em>
|
||||||
|
</div>
|
||||||
|
<div slot="tip" class="el-upload__tip">只能上传Excel文件,且不超过10MB</div>
|
||||||
|
</el-upload>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudPurchase from '@/views/wms/pcs/purchaseorder/purchase'
|
||||||
|
import CRUD, { crud } from '@crud/crud'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'UploadDialog1',
|
||||||
|
mixins: [crud()],
|
||||||
|
components: {},
|
||||||
|
props: {
|
||||||
|
dialogShow: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
openParam: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
dialogVisible: false,
|
||||||
|
fileList: [],
|
||||||
|
file1: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
dialogShow: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.dialogVisible = newValue
|
||||||
|
}
|
||||||
|
},
|
||||||
|
openParam: {
|
||||||
|
handler(newValue, oldValue) {
|
||||||
|
this.opendtlParam = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open() {
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
},
|
||||||
|
is_one() {
|
||||||
|
this.crud.notify('只能上传一个excel文件!', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||||
|
},
|
||||||
|
// 文件校验方法
|
||||||
|
beforeAvatarUpload(file) {
|
||||||
|
// 不能导入大小超过2Mb的文件
|
||||||
|
if (file.size > 10 * 1024 * 1024) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
// 文件发生改变就会触发的事件
|
||||||
|
uploadByJsqd(file) {
|
||||||
|
this.file1 = file
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
if (this.beforeAvatarUpload(this.file1)) {
|
||||||
|
this.fileList.name = this.file1.name
|
||||||
|
this.fileList.url = ''
|
||||||
|
var formdata = new FormData()
|
||||||
|
formdata.append('file', this.file1.raw)
|
||||||
|
// excelImport:请求接口 formdata:传递参数
|
||||||
|
crudPurchase.excelImport(formdata).then((res) => {
|
||||||
|
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.$emit('tableChanged3', '')
|
||||||
|
this.$emit('update:dialogShow', false)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.crud.notify('文件过大,请上传小于10MB的文件〜', CRUD.NOTIFICATION_TYPE.WARNING)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
311
mes/qd/src/views/wms/pcs/purchaseplan/index.vue
Normal file
311
mes/qd/src/views/wms/pcs/purchaseplan/index.vue
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
<!--suppress ALL -->
|
||||||
|
<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-select
|
||||||
|
v-model="query.workshop_id"
|
||||||
|
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-date-picker
|
||||||
|
v-model="query.createTime"
|
||||||
|
type="daterange"
|
||||||
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
|
align="center"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="['00:00:00', '23:59:59']"
|
||||||
|
@change="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.create_mode"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
size="mini"
|
||||||
|
placeholder="生成方式"
|
||||||
|
class="filter-item"
|
||||||
|
@change="crud.toQuery"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.ST_INV_CREATE"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料">
|
||||||
|
<el-input
|
||||||
|
v-model="query.material_search"
|
||||||
|
size="mini"
|
||||||
|
clearable
|
||||||
|
placeholder="编码、名称"
|
||||||
|
@keyup.enter.native="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-upload2"
|
||||||
|
size="mini"
|
||||||
|
@click="downdtl"
|
||||||
|
>
|
||||||
|
导出EXCEL
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="uploadShow = true"
|
||||||
|
>
|
||||||
|
导入EXCEL
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-finished"
|
||||||
|
:disabled="crud.selections.length !== 1"
|
||||||
|
size="mini"
|
||||||
|
@click="commit(crud.selections)"
|
||||||
|
>
|
||||||
|
确认采购
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-check"
|
||||||
|
:disabled="crud.selections.length === 0"
|
||||||
|
size="mini"
|
||||||
|
@click="commit(crud.selections)"
|
||||||
|
>
|
||||||
|
强制完成
|
||||||
|
</el-button>
|
||||||
|
</crudOperation>
|
||||||
|
<!--表格渲染-->
|
||||||
|
<el-table
|
||||||
|
ref="table"
|
||||||
|
v-loading="crud.loading"
|
||||||
|
size="mini"
|
||||||
|
:data="crud.data"
|
||||||
|
highlight-current-row
|
||||||
|
show-summary
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
style="width: 100%;"
|
||||||
|
@select-all="crud.selectAllChange"
|
||||||
|
@selection-change="crud.selectionChangeHandler"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="workshop_id" label="车间"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="material_code" width="130" label="物料编号"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="material_name" width="130" label="物料名称"/>
|
||||||
|
<el-table-column prop="ask_time" label="要求到货日期" width="130" show-overflow-tooltip/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="qty" min-width="120" label="重量"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="agree_time" min-width="120" label="确认交货日期"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="po_code" min-width="120" label="订单编号"/>
|
||||||
|
<el-table-column show-overflow-tooltip prop="instor_qty" min-width="120" label="入库重量"/>
|
||||||
|
<!-- <el-table-column show-overflow-tooltip min-width="120" prop="biz_date" label="安全库存" />-->
|
||||||
|
<!-- <el-table-column label="总重量" align="center" prop="total_qty"/>-->
|
||||||
|
<el-table-column label="状态" align="center" prop="status" :formatter="stateFormat"/>
|
||||||
|
<el-table-column label="备注" align="center" prop="remark"/>
|
||||||
|
<el-table-column label="生成方式" align="center" prop="create_mode" :formatter="createModeFormat"/>
|
||||||
|
<el-table-column label="创建人" align="center" prop="create_name" width="150"/>
|
||||||
|
<el-table-column label="创建时间" align="center" prop="create_time" width="150"/>
|
||||||
|
<el-table-column label="提交人" align="center" prop="audit_namne" width="150"/>
|
||||||
|
<el-table-column label="提交时间" align="center" prop="audit_time" width="140px"/>
|
||||||
|
<el-table-column label="采购确认人" align="center" prop="purchase_name" width="150"/>
|
||||||
|
<el-table-column label="采购确认时间" align="center" prop="purchase_time" width="140px"/>
|
||||||
|
<el-table-column label="完成人" align="center" prop="confirm_name" width="150"/>
|
||||||
|
<el-table-column label="完成时间" align="center" prop="confirm_time" width="140px"/>
|
||||||
|
<!-- <el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<udOperation
|
||||||
|
:data="scope.row"
|
||||||
|
:permission="permission"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>-->
|
||||||
|
</el-table>
|
||||||
|
<!--分页组件-->
|
||||||
|
<pagination/>
|
||||||
|
</div>
|
||||||
|
<AddDialog @AddChanged="querytable"/>
|
||||||
|
<UploadDialog :dialog-show.sync="uploadShow" @tableChanged3="crud.toQuery()"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import crudPurchase from '@/views/wms/pcs/purchaseorder/purchase'
|
||||||
|
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 DateRangePicker from '@/components/DateRangePicker/index'
|
||||||
|
import AddDialog from '@/views/wms/pcs/purchaseorder/AddDialog'
|
||||||
|
import crudStorattr from '@/views/wms/storage_manage/basedata/basedata'
|
||||||
|
import { download } from '@/api/data'
|
||||||
|
import { downloadFile } from '@/utils'
|
||||||
|
import UploadDialog from "@/views/wms/pcs/purchaseplan/UploadDialog";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PurchasePlan',
|
||||||
|
components: {UploadDialog, AddDialog, crudOperation, rrOperation, udOperation, pagination, DateRangePicker},
|
||||||
|
cruds() {
|
||||||
|
return CRUD({
|
||||||
|
title: '',
|
||||||
|
optShow: {reset: true},
|
||||||
|
idField: 'id',
|
||||||
|
query: {
|
||||||
|
'status': '1'
|
||||||
|
},
|
||||||
|
url: '/api/pcsIfPurchaseorder',
|
||||||
|
crudMethod: {...crudPurchase}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
mixins: [presenter(), header(), crud()],
|
||||||
|
// 数据字典
|
||||||
|
dicts: ['PURCHASE_STATUS', 'product_area', 'ST_CREATE_MODE'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
height: document.documentElement.clientHeight - 180 + 'px;',
|
||||||
|
permission: {},
|
||||||
|
disShow: false,
|
||||||
|
viewShow: false,
|
||||||
|
mstrow: {},
|
||||||
|
divShow: false,
|
||||||
|
openParam: [],
|
||||||
|
uploadShow: false,
|
||||||
|
currentRow: null,
|
||||||
|
storlist: [],
|
||||||
|
storId: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted: function () {
|
||||||
|
const that = this
|
||||||
|
window.onresize = function temp() {
|
||||||
|
that.height = document.documentElement.clientHeight - 180 + 'px;'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
crudStorattr.getStor({'stor_type': '3'}).then(res => {
|
||||||
|
this.storlist = res.content
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getSummaries(param) {
|
||||||
|
const {columns, data} = param;
|
||||||
|
const sums = [];
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = '合计';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const values = data.map(item => Number(item[column.property]));
|
||||||
|
if (column.property === 'qty' || column.property === 'instor_qty') {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr);
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return prev + curr;
|
||||||
|
} else {
|
||||||
|
return prev;
|
||||||
|
}
|
||||||
|
}, 0);
|
||||||
|
sums[index] += ' KG';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return sums;
|
||||||
|
},
|
||||||
|
bill_typeFormat(row, column) {
|
||||||
|
return this.dict.label.ST_INV_RAW_IN_TYPE[row.bill_type]
|
||||||
|
},
|
||||||
|
downdtl() {
|
||||||
|
crud.downloadLoading = true
|
||||||
|
download('/api/pcsIfPurchaseorder/download', this.crud.query
|
||||||
|
).then(result => {
|
||||||
|
debugger
|
||||||
|
downloadFile(result, '原料需求', 'xlsx')
|
||||||
|
crud.downloadLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
crud.downloadLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
commit(rows) {
|
||||||
|
crudPurchase.commit(rows).then(res => {
|
||||||
|
this.crud.notify('单据确认成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
this.crud.toQuery()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
,
|
||||||
|
stateFormat(row, column) {
|
||||||
|
return this.dict.label.PURCHASE_STATUS[row.status]
|
||||||
|
}
|
||||||
|
,
|
||||||
|
createModeFormat(row, column) {
|
||||||
|
return this.dict.label.ST_CREATE_MODE[row.create_mode]
|
||||||
|
}
|
||||||
|
,
|
||||||
|
querytable() {
|
||||||
|
this.onSelectAll()
|
||||||
|
this.crud.toQuery()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
||||||
|
::v-deep .el-dialog__body {
|
||||||
|
padding-top: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
58
mes/qd/src/views/wms/pcs/purchaseplan/purchase.js
Normal file
58
mes/qd/src/views/wms/pcs/purchaseplan/purchase.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function add(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function del(ids) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/delete',
|
||||||
|
method: 'post',
|
||||||
|
data: ids
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function edit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/update',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function confirm(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/confirm',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDtl(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/getDtl',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function commit(data) {
|
||||||
|
return request({
|
||||||
|
url: '/api/pcsIfPurchaseorder/commit',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
del,
|
||||||
|
confirm,
|
||||||
|
getDtl,
|
||||||
|
commit
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user