Merge branch 'master' of http://121.40.234.130:8899/root/wuHanXinRui
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
|
||||
package org.nl.wms.pdm.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.service.LocalStorageService;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.nl.wms.pdm.service.DailyplanService;
|
||||
import org.nl.wms.pdm.service.ProducetaskprocService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "生产计划管理")
|
||||
@RequestMapping("/api/dailyplan")
|
||||
@Slf4j
|
||||
public class DailyplanController {
|
||||
|
||||
private final DailyplanService dailyplanService;
|
||||
private final LocalStorageService localStorageService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询月生产计划")
|
||||
@ApiOperation("查询月生产计划")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(dailyplanService.
|
||||
queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
@PostMapping
|
||||
@Log("新增工令")
|
||||
@ApiOperation("新增工令")
|
||||
public ResponseEntity<Object> create(@RequestBody JSONObject json){
|
||||
dailyplanService.create(json);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@Log("查询月生产计划")
|
||||
@ApiOperation("查询月生产计划")
|
||||
@GetMapping("/mouthtask")
|
||||
public ResponseEntity<Object> mouthtask(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(dailyplanService.
|
||||
queryAll2(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改工令")
|
||||
@ApiOperation("修改工令")
|
||||
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson){
|
||||
dailyplanService.update(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除月生产计划")
|
||||
@ApiOperation("删除月生产计划")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
dailyplanService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("提交")
|
||||
@ApiOperation("提交")
|
||||
@PostMapping("/submit")
|
||||
public ResponseEntity<Object> submit(@RequestBody JSONObject whereJson) {
|
||||
dailyplanService.submit(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("提交")
|
||||
@ApiOperation("提交")
|
||||
@PostMapping("/submit2")
|
||||
public ResponseEntity<Object> submit2(@RequestBody JSONObject whereJson) {
|
||||
dailyplanService.submit2(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("获取明细list")
|
||||
@ApiOperation("获取Bom明细list")
|
||||
@GetMapping("/getDevices")
|
||||
public ResponseEntity<Object> getDevices(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(dailyplanService.getDevices(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取明细list")
|
||||
@ApiOperation("获取Bom明细list")
|
||||
@GetMapping("/getCapacitytes")
|
||||
public ResponseEntity<Object> getCapacitytes(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(dailyplanService.getCapacitytes(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
|
||||
dailyplanService.download(whereJson, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
|
||||
package org.nl.wms.pdm.rest;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
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.domain.LocalStorage;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.service.LocalStorageService;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.pcs.service.ProductplanprocService;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.nl.wms.pdm.service.ProducetaskprocService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "生产计划管理")
|
||||
@RequestMapping("/api/producetask")
|
||||
@Slf4j
|
||||
public class ProducetaskController {
|
||||
|
||||
private final ProducetaskprocService producetaskprocService;
|
||||
private final LocalStorageService localStorageService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询月生产计划")
|
||||
@ApiOperation("查询月生产计划")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(producetaskprocService.
|
||||
queryAll(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("查询月生产计划")
|
||||
@ApiOperation("查询月生产计划")
|
||||
@GetMapping("/mouthtask")
|
||||
public ResponseEntity<Object> mouthtask(@RequestParam Map whereJson, Pageable page){
|
||||
return new ResponseEntity<>(producetaskprocService.
|
||||
queryAll2(whereJson,page),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改月生产计划")
|
||||
@ApiOperation("修改月生产计划")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody ProductplanprocDto dto){
|
||||
producetaskprocService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除月生产计划")
|
||||
@ApiOperation("删除月生产计划")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
producetaskprocService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("提交")
|
||||
@ApiOperation("提交")
|
||||
@PostMapping("/submit")
|
||||
public ResponseEntity<Object> submit(@RequestBody JSONObject whereJson) {
|
||||
producetaskprocService.submit(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("提交")
|
||||
@ApiOperation("提交")
|
||||
@PostMapping("/submit2")
|
||||
public ResponseEntity<Object> submit2(@RequestBody JSONObject whereJson) {
|
||||
producetaskprocService.submit2(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
@Log("导入月计划excel")
|
||||
@ApiOperation("导入月计划excel")
|
||||
@PostMapping({"/importExcel/{bomtype}"})
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> pictures(@RequestParam MultipartFile file, @PathVariable String bomtype) {
|
||||
LocalStorage localStorage = this.localStorageService.create((String) null, file);
|
||||
Long id = localStorage.getId();
|
||||
producetaskprocService.importExcel(id.toString());
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取明细list")
|
||||
@ApiOperation("获取Bom明细list")
|
||||
@GetMapping("/getDevices")
|
||||
public ResponseEntity<Object> getDevices(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(producetaskprocService.getDevices(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("获取明细list")
|
||||
@ApiOperation("获取Bom明细list")
|
||||
@GetMapping("/getCapacitytes")
|
||||
public ResponseEntity<Object> getCapacitytes(@RequestParam Map whereJson) {
|
||||
return new ResponseEntity<>(producetaskprocService.getCapacitytes(whereJson),HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
|
||||
package org.nl.wms.pdm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author Liuxy
|
||||
* @date 2021-12-13
|
||||
**/
|
||||
public interface DailyplanService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll2(Map whereJson, Pageable page);
|
||||
/**
|
||||
* 创建
|
||||
* @param json /
|
||||
*/
|
||||
void create(JSONObject json);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<ProductplanprocDto>
|
||||
*/
|
||||
List<ProductplanprocDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param plan_id ID
|
||||
* @return Productplanproc
|
||||
*/
|
||||
ProductplanprocDto findById(Long plan_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Productplanproc
|
||||
*/
|
||||
ProductplanprocDto findByCode(String code);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param whereJson /
|
||||
*/
|
||||
void update(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导入月计划表格
|
||||
* @param id /
|
||||
*/
|
||||
void importExcel(String id);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
void submit(JSONObject whereJson);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
void submit2(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getDevices(Map whereJson);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getCapacitytes(Map whereJson);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param whereJson
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
void download(Map whereJson, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
|
||||
package org.nl.wms.pdm.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description 服务接口
|
||||
* @author Liuxy
|
||||
* @date 2021-12-13
|
||||
**/
|
||||
public interface ProducetaskprocService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll2(Map whereJson, Pageable page);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param whereJson 条件参数
|
||||
* @return List<ProductplanprocDto>
|
||||
*/
|
||||
List<ProductplanprocDto> queryAll(Map whereJson);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param plan_id ID
|
||||
* @return Productplanproc
|
||||
*/
|
||||
ProductplanprocDto findById(Long plan_id);
|
||||
|
||||
/**
|
||||
* 根据编码查询
|
||||
* @param code code
|
||||
* @return Productplanproc
|
||||
*/
|
||||
ProductplanprocDto findByCode(String code);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param dto /
|
||||
*/
|
||||
void update(ProductplanprocDto dto);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导入月计划表格
|
||||
* @param id /
|
||||
*/
|
||||
void importExcel(String id);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
void submit(JSONObject whereJson);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
void submit2(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getDevices(Map whereJson);
|
||||
/**
|
||||
* 提交
|
||||
* @param whereJson /
|
||||
*/
|
||||
JSONArray getCapacitytes(Map whereJson);
|
||||
}
|
||||
@@ -0,0 +1,578 @@
|
||||
|
||||
package org.nl.wms.pdm.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
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.excel.EasyExcel;
|
||||
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.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||
import org.nl.wms.basedata.master.service.dto.MaterialbaseDto;
|
||||
import org.nl.wms.pcs.Enum.IsProcEnum;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.nl.wms.pdm.service.DailyplanService;
|
||||
import org.nl.wms.pdm.service.ProducetaskprocService;
|
||||
import org.nl.wms.pdm.service.WorkOrdereService;
|
||||
import org.nl.wms.st.core.service.StorPublicService;
|
||||
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 javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2021-12-13
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DailyplanServiceImpl implements DailyplanService {
|
||||
private final MaterialbaseService materialbaseService;
|
||||
|
||||
private final WorkOrdereService workOrdereService;
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
|
||||
String material_code = map.get("material_code");
|
||||
if (StrUtil.isNotEmpty(material_code)) {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
map.put("flag", "1");
|
||||
JSONObject jret = WQL.getWO("QPDM_PRODUCTDAILYPLAN").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.planstart_date desc");
|
||||
JSONArray json = jret.getJSONArray("content");
|
||||
JSONArray ja = new JSONArray();
|
||||
for(int i=0;i<json.size();i++){
|
||||
JSONObject jo = json.getJSONObject(i);
|
||||
String planend_date = jo.getString("planend_date");
|
||||
Date date = DateUtil.parse(planend_date);
|
||||
|
||||
String plan_finish_date = jo.getString("plan_finish_date");
|
||||
Date date2 = DateUtil.parse(plan_finish_date);
|
||||
long days = (int) DateUtil.between(date2,date, DateUnit.DAY);
|
||||
jo.put("day_num",days);
|
||||
ja.add(jo);
|
||||
}
|
||||
jret.put("content",ja);
|
||||
return jret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll2(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
|
||||
String material_code = map.get("material_code");
|
||||
if (StrUtil.isNotEmpty(material_code)) {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
|
||||
String task_code = map.get("task_code");
|
||||
if (StrUtil.isNotEmpty(task_code)) {
|
||||
map.put("task_code", "%" + task_code + "%");
|
||||
}
|
||||
map.put("flag", "2");
|
||||
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.input_time desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductplanprocDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<ProductplanprocDto> list = arr.toJavaList(ProductplanprocDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductplanprocDto findById(Long plan_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
JSONObject json = wo.query("plan_id =" + plan_id + "").uniqueResult(0);
|
||||
final ProductplanprocDto obj = json.toJavaObject(ProductplanprocDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductplanprocDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final ProductplanprocDto obj = json.toJavaObject(ProductplanprocDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
WQLObject pdm_bi_productdeptpcsn = WQLObject.getWQLObject("pdm_bi_productdeptpcsn");
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
WQLObject MD_ME_ProducMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt"); // 工艺路线主表
|
||||
// 插入主表
|
||||
json.put("dailyplan_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
String workorder_code = CodeUtil.getNewCode("R_CODE");
|
||||
json.put("plan_code", workorder_code);
|
||||
json.put("weight_unit_id", "1");
|
||||
json.put("weight_unit_name", "千克\\公斤");
|
||||
json.put("status", "01");
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", nickName);
|
||||
json.put("create_time", now);
|
||||
|
||||
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+json.getString("material_id")+"'").uniqueResult(0);
|
||||
double standard_weight = mater.getDouble("standard_weight_pft");
|
||||
if(standard_weight ==0){
|
||||
throw new BadRequestException("配粉桶标准重量不能为0!");
|
||||
}
|
||||
json.put("product_num", NumberUtil.round(json.getDouble("product_weight")/standard_weight,0));
|
||||
|
||||
|
||||
JSONObject product = pdm_bi_productdeptpcsn.query("org_code='"+json.getString("plan_org_code")+"'").uniqueResult(0);
|
||||
|
||||
json.put("plan_org_name", product.getString("org_name"));
|
||||
|
||||
json.put("product_series", json.getString("product_series_id"));
|
||||
json.put("planend_date", now.substring(0,10));
|
||||
MPS_BD_ProductDailyPlan.insert(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(JSONObject whereJson) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
|
||||
WQLObject pdm_bi_productdeptpcsn = WQLObject.getWQLObject("pdm_bi_productdeptpcsn");
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
WQLObject MD_ME_ProducMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt"); // 工艺路线主表
|
||||
// 插入主表
|
||||
|
||||
whereJson.put("update_optid", currentUserId);
|
||||
whereJson.put("update_optname", nickName);
|
||||
whereJson.put("update_time", now);
|
||||
|
||||
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+whereJson.getString("material_id")+"'").uniqueResult(0);
|
||||
double standard_weight = mater.getDouble("standard_weight_pft");
|
||||
if(standard_weight ==0){
|
||||
throw new BadRequestException("配粉桶标准重量不能为0!");
|
||||
}
|
||||
whereJson.put("product_num", NumberUtil.round(whereJson.getDouble("product_weight")/standard_weight,0));
|
||||
|
||||
|
||||
JSONObject product = pdm_bi_productdeptpcsn.query("org_code='"+whereJson.getString("plan_org_code")+"'").uniqueResult(0);
|
||||
|
||||
whereJson.put("plan_org_name", product.getString("org_name"));
|
||||
|
||||
whereJson.put("product_series", whereJson.getString("product_series_id"));
|
||||
whereJson.put("planend_date", now.substring(0,10));
|
||||
MPS_BD_ProductDailyPlan.update(whereJson);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
WQLObject PCS_IF_ProductPlanProc = WQLObject.getWQLObject("PCS_IF_ProductPlanProc");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
for (Long dailyplan_id : ids) {
|
||||
JSONObject jo = MPS_BD_ProductDailyPlan.query("dailyplan_id='"+dailyplan_id+"'").uniqueResult(0);
|
||||
if(jo==null){
|
||||
throw new BadRequestException("该记录不存在!");
|
||||
}
|
||||
MPS_BD_ProductDailyPlan.delete("dailyplan_id='"+dailyplan_id+"'");
|
||||
String plan_id = jo.getString("plan_id");
|
||||
if (StrUtil.isNotEmpty(plan_id)) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_proc", "1");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
PCS_IF_ProductPlanProc.update(map, "plan_id ='" + plan_id + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submit(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
JSONArray ja = json.getJSONArray("rows");
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
JSONObject jsonMst = MPS_BD_ProductDailyPlan.query("dailyplan_id ='" + jo.getString("dailyplan_id") + "' and status = '01'").uniqueResult(0);
|
||||
if (jsonMst == null) {
|
||||
throw new BadRequestException("当前记录状态异常,操作失败!");
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("status", "02");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
MPS_BD_ProductDailyPlan.update(map, "dailyplan_id ='" + jo.getString("dailyplan_id") + "'");
|
||||
|
||||
JSONObject new_jo = new JSONObject();
|
||||
|
||||
new_jo.put("pcsn_num",jo.getString("product_num"));
|
||||
new_jo.put("workorder_type","01");
|
||||
new_jo.put("device_id",jo.getString("device_id"));
|
||||
new_jo.put("material_id",jo.getString("material_id"));
|
||||
new_jo.put("product_series_id",jo.getString("mater_product_series"));
|
||||
new_jo.put("product_series",jo.getString("mater_product_series"));
|
||||
new_jo.put("workorder_qty",jo.getString("standard_weight"));
|
||||
|
||||
new_jo.put("qty_unit_id",jo.getString("weight_unit_id"));
|
||||
new_jo.put("qty_unit_name",jo.getString("weight_unit_name"));
|
||||
new_jo.put("workorder_qty",jo.getString("standard_weight"));
|
||||
new_jo.put("planstart_time",jo.getString("planstart_date").substring(0,10)+" 08:00:00");
|
||||
new_jo.put("status","10");
|
||||
new_jo.put("source_bill_id",jo.getString("dailyplan_id"));
|
||||
new_jo.put("source_bill_type",jo.getString("workorder_type"));
|
||||
new_jo.put("source_bill_code",jo.getString("plan_code"));
|
||||
|
||||
new_jo.put("org_id",jo.getString("org_id"));
|
||||
new_jo.put("is_experiment","0");
|
||||
workOrdereService.create(new_jo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String id) {
|
||||
WQLObject planProcTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
JSONObject json = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "1").addParam("id", id).process().uniqueResult(0);
|
||||
//根据路径获取表格里的记录
|
||||
String path = json.getString("path");
|
||||
List<Map<String, Object>> listMap = EasyExcel.read(path).sheet().doReadSync();
|
||||
listMap.remove(0);
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
Map<String, Object> map = listMap.get(i);
|
||||
|
||||
String plan_code = String.valueOf(map.get(0));
|
||||
String plan_month = String.valueOf(map.get(1));
|
||||
String plan_org_code = String.valueOf(map.get(2));
|
||||
String plan_org_name = String.valueOf(map.get(3));
|
||||
String material_code = String.valueOf(map.get(4));
|
||||
String product_type_name = String.valueOf(map.get(5));
|
||||
Long product_weight = Long.valueOf((String) map.get(6));
|
||||
String plan_finish_date = String.valueOf(map.get(7));
|
||||
String remark = String.valueOf(map.get(8));
|
||||
//校验数据准确性
|
||||
JSONObject jsonTab = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "2").addParam("code", plan_org_code).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonTab)) {
|
||||
throw new BadRequestException("没有此【" + plan_org_name + "】单位");
|
||||
}
|
||||
JSONObject jsonMater = materTab.query("material_code = '" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) {
|
||||
throw new BadRequestException("没有此【" + material_code + "】物料");
|
||||
}
|
||||
//月生产计划接口处理表数据
|
||||
ProductplanprocDto dto = new ProductplanprocDto();
|
||||
dto.setPlan_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setPlan_code(plan_code);
|
||||
dto.setPlan_month(plan_month);
|
||||
dto.setPlan_org_code(plan_org_code);
|
||||
dto.setPlan_org_name(plan_org_name);
|
||||
dto.setMaterial_id(jsonMater.getLong
|
||||
("material_id"));
|
||||
dto.setMaterial_code(material_code);
|
||||
dto.setMaterial_name(jsonMater.getString("material_name"));
|
||||
dto.setMaterial_spec(jsonMater.getString("material_spec"));
|
||||
dto.setProduct_type_name(product_type_name);
|
||||
|
||||
MaterialbaseDto materDto = materialbaseService.findById(jsonMater.getLong
|
||||
("material_id"));
|
||||
dto.setWeight_unit_name(materDto.getBase_unit_name());
|
||||
dto.setWeight_unit_id(materDto.getBase_unit_id());
|
||||
|
||||
dto.setProduct_weight(BigDecimal.valueOf(product_weight));
|
||||
dto.setFact_weight(BigDecimal.valueOf(product_weight));
|
||||
dto.setPlan_finish_date(plan_finish_date);
|
||||
dto.setInput_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setInput_optname(SecurityUtils.getNickName());
|
||||
dto.setInput_time(DateUtil.now());
|
||||
dto.setIs_proc("0");
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setRemark(remark);
|
||||
dto.setTask_code(CodeUtil.getNewCode("PCS_TASK_CODE"));
|
||||
//判断表里有没有此条记录
|
||||
JSONObject jsonObject = planProcTab.query("plan_org_code = '" + plan_org_code + "' and plan_month = '" + plan_month + "' and material_code ='" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
} else {
|
||||
if (!StrUtil.equals(jsonObject.getString("is_proc"), "2")) {
|
||||
continue;
|
||||
} else {
|
||||
//如果是生成状态则将当前记录删除,在重新插入
|
||||
planProcTab.delete(jsonObject);
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submit2(JSONObject form) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject PCS_IF_ProductPlanProc = WQLObject.getWQLObject("PCS_IF_ProductPlanProc");
|
||||
WQLObject MPS_BD_CapacityTemplateSeries = WQLObject.getWQLObject("MPS_BD_CapacityTemplateSeries");
|
||||
JSONArray ja = form.getJSONArray("rows");
|
||||
JSONObject json = form.getJSONObject("query");
|
||||
String captemplate_id = json.getString("captemplate_id");
|
||||
if (StrUtil.isEmpty(captemplate_id)) {
|
||||
throw new BadRequestException("排产模板不能为空!");
|
||||
}
|
||||
String checked = json.getString("checked");
|
||||
if (StrUtil.isEmpty(checked)) {
|
||||
checked = "false";
|
||||
}
|
||||
//已经生成日计划的月计划列表
|
||||
HashMap<String,String> used_map = new HashMap<String,String>();
|
||||
|
||||
//分组
|
||||
HashMap<String,JSONArray> device_map = new HashMap<String,JSONArray>();
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
String device_id = jo.getString("device_id");
|
||||
if (StrUtil.isEmpty(device_id)) {
|
||||
throw new BadRequestException("关键设备不能为空!");
|
||||
}
|
||||
if(device_map.containsKey(device_id)){
|
||||
JSONArray rows = device_map.get(device_id);
|
||||
rows.add(jo);
|
||||
device_map.put(device_id,rows);
|
||||
}else{
|
||||
JSONArray rows = new JSONArray();
|
||||
rows.add(jo);
|
||||
device_map.put(device_id,rows);
|
||||
}
|
||||
}
|
||||
//排序
|
||||
HashMap<String,JSONArray> device_map2 = new HashMap<String,JSONArray>();
|
||||
device_map.forEach((key,rows)->{
|
||||
List<JSONObject> list = JSONObject.parseArray(rows.toJSONString(), JSONObject.class);
|
||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||
String s1 = o1.getString("plan_finish_date");
|
||||
//转成JSON对象中保存的值类型
|
||||
double a = Double.parseDouble(s1.replace("-",""));
|
||||
double b = Double.parseDouble(o2.getString("plan_finish_date").replace("-",""));
|
||||
|
||||
String s1_old_mark = o1.getString("old_mark");
|
||||
String s2_old_mark = o2.getString("old_mark");
|
||||
|
||||
String s1_material_code = o1.getString("material_code");
|
||||
String s2_material_code = o2.getString("material_code");
|
||||
// 如果a, b数据类型为int,可直接 return a - b ;(升序,降序为 return b - a;)
|
||||
if (a > b) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(a == b) {
|
||||
if (s1_old_mark.compareTo(s2_old_mark)>0) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(s1_old_mark.compareTo(s2_old_mark) == 0) {
|
||||
|
||||
if (s1_material_code.compareTo(s2_material_code)>0) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(s1_material_code.compareTo(s2_material_code) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
rows = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
device_map2.put(key,rows);
|
||||
});
|
||||
|
||||
String finalChecked = checked;
|
||||
device_map2.forEach((key, rows)->{
|
||||
String nowstart_date = json.getString("nowstart_date");
|
||||
Date date = DateUtil.parse(nowstart_date);
|
||||
for(int i=0;i<rows.size();i++){
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
|
||||
double fact_weight = jo.getDouble("fact_weight");
|
||||
double standard_weight = jo.getDouble("standard_weight");
|
||||
//批次数
|
||||
BigDecimal pcsn_num = NumberUtil.round(fact_weight/standard_weight,0);
|
||||
|
||||
JSONObject series = MPS_BD_CapacityTemplateSeries.query("captemplate_id='"+captemplate_id+"' and product_series_id='"+jo.getString("product_series")+"'").uniqueResult(0);
|
||||
if(series ==null){
|
||||
throw new BadRequestException("系列模板产能未配置!");
|
||||
}
|
||||
//最大产能批次
|
||||
int totalproducecapacity_qty = series.getInteger("totalproducecapacity_qty");
|
||||
//若初始日期不为空,取此初始日期
|
||||
if(finalChecked.equals("true") && StrUtil.isNotEmpty(nowstart_date)){
|
||||
while(pcsn_num.intValue() > 0){
|
||||
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
|
||||
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
|
||||
if(ProcessRoute==null){
|
||||
throw new BadRequestException("产品工艺路线未设置不允许预排!");
|
||||
}
|
||||
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
|
||||
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
|
||||
|
||||
if(pcsn_num.intValue() > totalproducecapacity_qty){
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
|
||||
jo.put("product_num",totalproducecapacity_qty);
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
|
||||
//this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(pcsn_num.intValue() - totalproducecapacity_qty);
|
||||
}else{
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",pcsn_num.intValue()*standard_weight);
|
||||
jo.put("product_num",pcsn_num.intValue());
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planstart_date));
|
||||
//this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(0);
|
||||
}
|
||||
}
|
||||
|
||||
}else{//若初始日期为空,获取日计划表设备标识=此分组设备的最后一个计划
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
JSONObject jsonMst = PCS_IF_ProductPlanProc.query("plan_id ='" + jo.getString("plan_id") + "' and is_proc = '1'").uniqueResult(0);
|
||||
if (jsonMst == null) {
|
||||
throw new BadRequestException(jo.getString("task_code")+"当前记录状态异常,操作失败!");
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_proc", "2");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
PCS_IF_ProductPlanProc.update(map, "plan_id ='" + jo.getString("plan_id") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getDevices(Map json) {
|
||||
HashMap<String, String> map = new HashMap<>(json);
|
||||
map.put("flag", "3");
|
||||
JSONArray ret = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).process().getResultJSONArray(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getCapacitytes(Map json) {
|
||||
HashMap<String, String> map = new HashMap<>(json);
|
||||
map.put("flag", "4");
|
||||
JSONArray ret = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).process().getResultJSONArray(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void download(Map whereJson, HttpServletResponse response) throws IOException {
|
||||
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
String material_code = map.get("material_code");
|
||||
if (StrUtil.isNotEmpty(material_code)) {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
map.put("flag", "2");
|
||||
JSONArray rows = WQL.getWO("QPDM_PRODUCTDAILYPLAN").addParamMap(map).process().getResultJSONArray(0);
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
Map<String, Object> dtl_map = new LinkedHashMap<>();
|
||||
dtl_map.put("日计划编号", jo.getString("plan_code"));
|
||||
dtl_map.put("系列产线", jo.getString("product_series_name"));
|
||||
dtl_map.put("关键设备", jo.getString("device_code"));
|
||||
dtl_map.put("计划开始日期", jo.getString("planstart_date"));
|
||||
dtl_map.put("申报单位", jo.getString("plan_org_name"));
|
||||
if(jo.getString("workorder_type").equals("01")){
|
||||
dtl_map.put("计划类型", "生产计划");
|
||||
}else{
|
||||
dtl_map.put("计划类型", "临时计划");
|
||||
}
|
||||
dtl_map.put("产品编号", jo.getString("material_code"));
|
||||
dtl_map.put("牌号", jo.getString("old_mark"));
|
||||
dtl_map.put("产品系列", jo.getString("mater_product_series_name"));
|
||||
dtl_map.put("生产重量(kg)", jo.getString("product_weight"));
|
||||
dtl_map.put("批数", jo.getString("product_num"));
|
||||
dtl_map.put("计划结束日期", jo.getString("planend_date"));
|
||||
dtl_map.put("计划交货日期", jo.getString("plan_finish_date"));
|
||||
|
||||
String planend_date = jo.getString("planend_date");
|
||||
Date date = DateUtil.parse(planend_date);
|
||||
String plan_finish_date = jo.getString("plan_finish_date");
|
||||
Date date2 = DateUtil.parse(plan_finish_date);
|
||||
long days = (int) DateUtil.between(date2,date, DateUnit.DAY);
|
||||
|
||||
dtl_map.put("提前天数", days);
|
||||
|
||||
if(jo.getString("status").equals("01")){
|
||||
dtl_map.put("状态", "生成");
|
||||
}else{
|
||||
dtl_map.put("状态", "提交");
|
||||
}
|
||||
dtl_map.put("创建人", jo.getString("create_name"));
|
||||
dtl_map.put("创建时间", jo.getString("create_time"));
|
||||
dtl_map.put("备注", jo.getString("remark"));
|
||||
list.add(dtl_map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,600 @@
|
||||
|
||||
package org.nl.wms.pdm.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.excel.EasyExcel;
|
||||
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.modules.security.service.dto.JwtUserDto;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.utils.FileUtil;
|
||||
import org.nl.utils.SecurityUtils;
|
||||
import org.nl.wms.basedata.master.service.MaterialbaseService;
|
||||
import org.nl.wms.basedata.master.service.dto.MaterialbaseDto;
|
||||
import org.nl.wms.pcs.Enum.IsProcEnum;
|
||||
import org.nl.wms.pcs.service.ProductplanprocService;
|
||||
import org.nl.wms.pcs.service.dto.ProductplanprocDto;
|
||||
import org.nl.wms.pdm.service.ProducetaskprocService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.nl.wql.util.WqlUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2021-12-13
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ProducetaskprocServiceImpl implements ProducetaskprocService {
|
||||
private final MaterialbaseService materialbaseService;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
|
||||
String material_code = map.get("material_code");
|
||||
if (StrUtil.isNotEmpty(material_code)) {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
map.put("flag", "1");
|
||||
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "pp.input_time desc");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll2(Map whereJson, Pageable page) {
|
||||
HashMap<String, String> map = new HashMap<>(whereJson);
|
||||
|
||||
String material_code = map.get("material_code");
|
||||
if (StrUtil.isNotEmpty(material_code)) {
|
||||
map.put("material_code", "%" + material_code + "%");
|
||||
}
|
||||
|
||||
String task_code = map.get("task_code");
|
||||
if (StrUtil.isNotEmpty(task_code)) {
|
||||
map.put("task_code", "%" + task_code + "%");
|
||||
}
|
||||
map.put("flag", "2");
|
||||
JSONObject json = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "deviceinfo.device_code,pp.plan_finish_date,ext.old_mark,pp.material_code");
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductplanprocDto> queryAll(Map whereJson) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
JSONArray arr = wo.query().getResultJSONArray(0);
|
||||
List<ProductplanprocDto> list = arr.toJavaList(ProductplanprocDto.class);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductplanprocDto findById(Long plan_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
JSONObject json = wo.query("plan_id =" + plan_id + "").uniqueResult(0);
|
||||
final ProductplanprocDto obj = json.toJavaObject(ProductplanprocDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductplanprocDto findByCode(String code) {
|
||||
WQLObject wo = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
|
||||
final ProductplanprocDto obj = json.toJavaObject(ProductplanprocDto.class);
|
||||
return obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(ProductplanprocDto dto) {
|
||||
ProductplanprocDto entity = this.findById(dto.getPlan_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
String is_proc = dto.getIs_proc();
|
||||
if (!StrUtil.equals(IsProcEnum.GENERATE.getCode(), is_proc)) {
|
||||
throw new BadRequestException("不为生成状态,不可修改");
|
||||
}
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
//校验数据
|
||||
String plan_org_code = dto.getPlan_org_code();
|
||||
String material_code = dto.getMaterial_code();
|
||||
String product_type_name = dto.getProduct_type_name();
|
||||
String weight_unit_name = dto.getWeight_unit_name();
|
||||
JSONObject jsonDept = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "2").addParam("code", plan_org_code).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonDept)) { // 部门
|
||||
throw new BadRequestException("没有此【" + jsonDept.getString("label") + "】单位");
|
||||
}
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
JSONObject jsonMater = materTab.query("material_code = '" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) { // 物料
|
||||
throw new BadRequestException("没有此【" + material_code + "】物料");
|
||||
}
|
||||
JSONObject jsonDict = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "6").addParam("product_type_name", product_type_name).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonDict)) { // 生产方式
|
||||
throw new BadRequestException("没有此【" + product_type_name + "】生产方式");
|
||||
}
|
||||
JSONObject jsonUnit = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "5").addParam("weight_unit_name", weight_unit_name).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonUnit)) { // 单位
|
||||
throw new BadRequestException("没有此【" + weight_unit_name + "】计量单位");
|
||||
}
|
||||
|
||||
WQLObject procTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject planTab = WQLObject.getWQLObject("PCS_IF_ProductPlan");
|
||||
dto.setMaterial_id(Long.valueOf(jsonMater.getString("material_id")));
|
||||
dto.setMaterial_code(material_code);
|
||||
dto.setMaterial_name(jsonMater.getString("material_name"));
|
||||
dto.setMaterial_spec(jsonMater.getString("material_spec"));
|
||||
dto.setProduct_type_name(jsonDict.getString("label"));
|
||||
dto.setWeight_unit_id(Long.valueOf(jsonUnit.getString("measure_unit_id")));
|
||||
dto.setFact_weight(dto.getProduct_weight());
|
||||
dto.setWeight_unit_name(weight_unit_name);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_optid(currentUserId);
|
||||
dto.setUpdate_optname(nickName);
|
||||
// 更新接口处理表
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
procTab.update(json);
|
||||
// 更新接口表
|
||||
JSONObject jsonPlan = planTab.query("plan_id = '" + dto.getPlan_id() + "'").uniqueResult(0);
|
||||
jsonPlan.put("plan_month", dto.getPlan_month());
|
||||
jsonPlan.put("plan_org_code", dto.getPlan_org_code());
|
||||
jsonPlan.put("plan_org_name", dto.getPlan_org_name());
|
||||
jsonPlan.put("material_id", dto.getMaterial_id());
|
||||
jsonPlan.put("material_code", dto.getMaterial_code());
|
||||
jsonPlan.put("material_name", dto.getMaterial_name());
|
||||
jsonPlan.put("material_spec", dto.getMaterial_spec());
|
||||
jsonPlan.put("product_type_name", dto.getProduct_type_name());
|
||||
jsonPlan.put("weight_unit_id", dto.getWeight_unit_id());
|
||||
jsonPlan.put("weight_unit_name", dto.getWeight_unit_name());
|
||||
jsonPlan.put("product_weight", dto.getProduct_weight());
|
||||
jsonPlan.put("plan_finish_date", dto.getPlan_finish_date());
|
||||
planTab.update(jsonPlan);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
WQLObject procTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
for (Long plan_id : ids) {
|
||||
JSONObject jsonProc = procTab.query("plan_id = '" + plan_id + "'").uniqueResult(0);
|
||||
if(StrUtil.equals(jsonProc.getString("is_proc"), "2")){
|
||||
throw new BadRequestException("排产状态,不可删除");
|
||||
}
|
||||
procTab.delete(jsonProc);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submit(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject PCS_IF_ProductPlanProc = WQLObject.getWQLObject("PCS_IF_ProductPlanProc");
|
||||
JSONArray ja = json.getJSONArray("rows");
|
||||
String status = json.getString("status");
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
JSONObject jsonMst = PCS_IF_ProductPlanProc.query("plan_id ='" + jo.getString("plan_id") + "' and is_proc = '0'").uniqueResult(0);
|
||||
if (jsonMst == null) {
|
||||
throw new BadRequestException("当前记录状态异常,操作失败!");
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_proc", status);
|
||||
map.put("fact_weight", jo.getString("fact_weight"));
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
PCS_IF_ProductPlanProc.update(map, "plan_id ='" + jo.getString("plan_id") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importExcel(String id) {
|
||||
|
||||
WQLObject planProcTab = WQLObject.getWQLObject("pcs_if_productplanproc");
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
|
||||
JSONObject json = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "1").addParam("id", id).process().uniqueResult(0);
|
||||
//根据路径获取表格里的记录
|
||||
String path = json.getString("path");
|
||||
List<Map<String, Object>> listMap = EasyExcel.read(path).sheet().doReadSync();
|
||||
listMap.remove(0);
|
||||
for (int i = 0; i < listMap.size(); i++) {
|
||||
Map<String, Object> map = listMap.get(i);
|
||||
|
||||
String plan_code = String.valueOf(map.get(0));
|
||||
String plan_month = String.valueOf(map.get(1));
|
||||
String plan_org_code = String.valueOf(map.get(2));
|
||||
String plan_org_name = String.valueOf(map.get(3));
|
||||
String material_code = String.valueOf(map.get(4));
|
||||
String product_type_name = String.valueOf(map.get(5));
|
||||
Long product_weight = Long.valueOf((String) map.get(6));
|
||||
String plan_finish_date = String.valueOf(map.get(7));
|
||||
String remark = String.valueOf(map.get(8));
|
||||
//校验数据准确性
|
||||
JSONObject jsonTab = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "2").addParam("code", plan_org_code).process().uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonTab)) {
|
||||
throw new BadRequestException("没有此【" + plan_org_name + "】单位");
|
||||
}
|
||||
JSONObject jsonMater = materTab.query("material_code = '" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonMater)) {
|
||||
throw new BadRequestException("没有此【" + material_code + "】物料");
|
||||
}
|
||||
//月生产计划接口处理表数据
|
||||
ProductplanprocDto dto = new ProductplanprocDto();
|
||||
dto.setPlan_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setPlan_code(plan_code);
|
||||
dto.setPlan_month(plan_month);
|
||||
dto.setPlan_org_code(plan_org_code);
|
||||
dto.setPlan_org_name(plan_org_name);
|
||||
dto.setMaterial_id(jsonMater.getLong
|
||||
("material_id"));
|
||||
dto.setMaterial_code(material_code);
|
||||
dto.setMaterial_name(jsonMater.getString("material_name"));
|
||||
dto.setMaterial_spec(jsonMater.getString("material_spec"));
|
||||
dto.setProduct_type_name(product_type_name);
|
||||
|
||||
MaterialbaseDto materDto = materialbaseService.findById(jsonMater.getLong
|
||||
("material_id"));
|
||||
dto.setWeight_unit_name(materDto.getBase_unit_name());
|
||||
dto.setWeight_unit_id(materDto.getBase_unit_id());
|
||||
|
||||
dto.setProduct_weight(BigDecimal.valueOf(product_weight));
|
||||
dto.setFact_weight(BigDecimal.valueOf(product_weight));
|
||||
plan_finish_date = plan_finish_date.replace('/','-');
|
||||
DateTime date = DateUtil.parse(plan_finish_date,"yyyy-MM-dd");
|
||||
dto.setPlan_finish_date(DateUtil.formatDate(date));
|
||||
dto.setInput_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setInput_optname(SecurityUtils.getNickName());
|
||||
dto.setInput_time(DateUtil.now());
|
||||
dto.setIs_proc("0");
|
||||
dto.setUpdate_optid(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_optname(SecurityUtils.getNickName());
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setRemark(remark);
|
||||
dto.setTask_code(CodeUtil.getNewCode("PCS_TASK_CODE"));
|
||||
//判断表里有没有此条记录
|
||||
JSONObject jsonObject = planProcTab.query("plan_org_code = '" + plan_org_code + "' and plan_month = '" + plan_month + "' and material_code ='" + material_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(jsonObject)) {
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
} else {
|
||||
if (!StrUtil.equals(jsonObject.getString("is_proc"), "2")) {
|
||||
continue;
|
||||
} else {
|
||||
//如果是生成状态则将当前记录删除,在重新插入
|
||||
planProcTab.delete(jsonObject);
|
||||
planProcTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submit2(JSONObject form) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
WQLObject PCS_IF_ProductPlanProc = WQLObject.getWQLObject("PCS_IF_ProductPlanProc");
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
WQLObject MD_ME_ProducMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt");
|
||||
WQLObject MPS_BD_CapacityTemplateSeries = WQLObject.getWQLObject("MPS_BD_CapacityTemplateSeries");
|
||||
JSONArray ja = form.getJSONArray("rows");
|
||||
JSONObject json = form.getJSONObject("query");
|
||||
String captemplate_id = json.getString("captemplate_id");
|
||||
if (StrUtil.isEmpty(captemplate_id)) {
|
||||
throw new BadRequestException("排产模板不能为空!");
|
||||
}
|
||||
String checked = json.getString("checked");
|
||||
if (StrUtil.isEmpty(checked)) {
|
||||
checked = "false";
|
||||
}
|
||||
//已经生成日计划的月计划列表
|
||||
HashMap<String,String> used_map = new HashMap<String,String>();
|
||||
|
||||
//分组
|
||||
HashMap<String,JSONArray> device_map = new HashMap<String,JSONArray>();
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
String device_id = jo.getString("device_id");
|
||||
if (StrUtil.isEmpty(device_id)) {
|
||||
throw new BadRequestException("关键设备不能为空!");
|
||||
}
|
||||
if(device_map.containsKey(device_id)){
|
||||
JSONArray rows = device_map.get(device_id);
|
||||
rows.add(jo);
|
||||
device_map.put(device_id,rows);
|
||||
}else{
|
||||
JSONArray rows = new JSONArray();
|
||||
rows.add(jo);
|
||||
device_map.put(device_id,rows);
|
||||
}
|
||||
}
|
||||
//排序
|
||||
HashMap<String,JSONArray> device_map2 = new HashMap<String,JSONArray>();
|
||||
device_map.forEach((key,rows)->{
|
||||
List<JSONObject> list = JSONObject.parseArray(rows.toJSONString(), JSONObject.class);
|
||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||
String s1 = o1.getString("plan_finish_date");
|
||||
//转成JSON对象中保存的值类型
|
||||
double a = Double.parseDouble(s1.replace("-",""));
|
||||
double b = Double.parseDouble(o2.getString("plan_finish_date").replace("-",""));
|
||||
|
||||
String s1_old_mark = o1.getString("old_mark");
|
||||
String s2_old_mark = o2.getString("old_mark");
|
||||
|
||||
String s1_material_code = o1.getString("material_code");
|
||||
String s2_material_code = o2.getString("material_code");
|
||||
// 如果a, b数据类型为int,可直接 return a - b ;(升序,降序为 return b - a;)
|
||||
if (a > b) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(a == b) {
|
||||
if (s1_old_mark.compareTo(s2_old_mark)>0) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(s1_old_mark.compareTo(s2_old_mark) == 0) {
|
||||
|
||||
if (s1_material_code.compareTo(s2_material_code)>0) { //降序排列,升序改成a>b
|
||||
return 1;
|
||||
} else if(s1_material_code.compareTo(s2_material_code) == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
rows = JSONArray.parseArray(JSON.toJSONString(list));
|
||||
device_map2.put(key,rows);
|
||||
});
|
||||
|
||||
String finalChecked = checked;
|
||||
device_map2.forEach((key, rows)->{
|
||||
String nowstart_date = json.getString("nowstart_date");
|
||||
Date date = DateUtil.parse(nowstart_date);
|
||||
for(int i=0;i<rows.size();i++){
|
||||
JSONObject jo = rows.getJSONObject(i);
|
||||
|
||||
double fact_weight = jo.getDouble("fact_weight");
|
||||
double standard_weight = jo.getDouble("standard_weight");
|
||||
//批次数
|
||||
BigDecimal pcsn_num = NumberUtil.round(fact_weight/standard_weight,0);
|
||||
|
||||
JSONObject series = MPS_BD_CapacityTemplateSeries.query("captemplate_id='"+captemplate_id+"' and product_series_id='"+jo.getString("product_series")+"'").uniqueResult(0);
|
||||
if(series ==null){
|
||||
throw new BadRequestException("系列模板产能未配置!");
|
||||
}
|
||||
//最大产能批次
|
||||
int totalproducecapacity_qty = series.getInteger("totalproducecapacity_qty");
|
||||
//若初始日期不为空,取此初始日期
|
||||
if(finalChecked.equals("true") && StrUtil.isNotEmpty(nowstart_date)){
|
||||
while(pcsn_num.intValue() > 0){
|
||||
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
|
||||
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
|
||||
if(ProcessRoute==null){
|
||||
throw new BadRequestException("产品工艺路线未设置不允许预排!");
|
||||
}
|
||||
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
|
||||
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
|
||||
|
||||
if(pcsn_num.intValue() > totalproducecapacity_qty){
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
|
||||
jo.put("product_num",totalproducecapacity_qty);
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
|
||||
this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(pcsn_num.intValue() - totalproducecapacity_qty);
|
||||
}else{
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",pcsn_num.intValue()*standard_weight);
|
||||
jo.put("product_num",pcsn_num.intValue());
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planstart_date));
|
||||
this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(0);
|
||||
}
|
||||
}
|
||||
}else{//若初始日期为空,获取日计划表设备标识=此分组设备的最后一个计划
|
||||
JSONObject last = MPS_BD_ProductDailyPlan.query("device_id='"+jo.getString("device_id")+"'","planstart_date desc").uniqueResult(0);
|
||||
if(last ==null ){
|
||||
throw new BadRequestException("日计划表此分组设备的最后一个计划为空!");
|
||||
}
|
||||
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+jo.getString("material_id")+"'").uniqueResult(0);
|
||||
String old_mark = mater.getString("old_mark");
|
||||
|
||||
if(jo.getString("old_mark").equals(old_mark)){
|
||||
nowstart_date = last.getString("planstart_date");
|
||||
date = DateUtil.parse(nowstart_date);
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
|
||||
while(pcsn_num.intValue() > 0){
|
||||
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
|
||||
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
|
||||
if(ProcessRoute==null){
|
||||
throw new BadRequestException("产品工艺路线未设置不允许预排!");
|
||||
}
|
||||
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
|
||||
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
|
||||
|
||||
if(pcsn_num.intValue() > totalproducecapacity_qty){
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
|
||||
jo.put("product_num",totalproducecapacity_qty);
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
|
||||
this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(pcsn_num.intValue() - totalproducecapacity_qty);
|
||||
}else{
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",pcsn_num.intValue()*standard_weight);
|
||||
jo.put("product_num",pcsn_num.intValue());
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planstart_date));
|
||||
this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(0);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
nowstart_date = last.getString("planstart_date");
|
||||
date = DateUtil.parse(nowstart_date);
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
|
||||
while(pcsn_num.intValue() > 0){
|
||||
JSONObject ProcessRoute = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag","5")
|
||||
.addParam("material_code",jo.getString("material_id")).process().uniqueResult(0);
|
||||
if(ProcessRoute==null){
|
||||
throw new BadRequestException("产品工艺路线未设置不允许预排!");
|
||||
}
|
||||
int total_plan_time = ProcessRoute.getInteger("total_plan_time");
|
||||
BigDecimal days = NumberUtil.round(total_plan_time/24,0);
|
||||
|
||||
if(pcsn_num.intValue() > totalproducecapacity_qty){
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",totalproducecapacity_qty*standard_weight);
|
||||
jo.put("product_num",totalproducecapacity_qty);
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planstart_date",DateUtil.formatDate(planstart_date));
|
||||
this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(pcsn_num.intValue() - totalproducecapacity_qty);
|
||||
}else{
|
||||
jo.put("workorder_type","01");
|
||||
jo.put("product_weight",pcsn_num.intValue()*standard_weight);
|
||||
jo.put("product_num",pcsn_num.intValue());
|
||||
jo.put("product_series_id",jo.getString("product_series"));
|
||||
jo.put("planstart_date",DateUtil.formatDate(date));
|
||||
|
||||
Date planstart_date = DateUtil.offsetDay(date,days.intValue()-1);
|
||||
jo.put("planend_date",DateUtil.formatDate(planstart_date));
|
||||
this.createDay(jo);
|
||||
|
||||
date = DateUtil.offsetDay(date,1);
|
||||
pcsn_num = BigDecimal.valueOf(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
JSONObject jsonMst = PCS_IF_ProductPlanProc.query("plan_id ='" + jo.getString("plan_id") + "' and is_proc = '1'").uniqueResult(0);
|
||||
if (jsonMst == null) {
|
||||
throw new BadRequestException(jo.getString("task_code")+"当前记录状态异常,操作失败!");
|
||||
}
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("is_proc", "2");
|
||||
map.put("update_optid", currentUserId + "");
|
||||
map.put("update_optname", nickName);
|
||||
map.put("update_time", now);
|
||||
PCS_IF_ProductPlanProc.update(map, "plan_id ='" + jo.getString("plan_id") + "'");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getDevices(Map json) {
|
||||
HashMap<String, String> map = new HashMap<>(json);
|
||||
map.put("flag", "3");
|
||||
JSONArray ret = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).process().getResultJSONArray(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getCapacitytes(Map json) {
|
||||
HashMap<String, String> map = new HashMap<>(json);
|
||||
map.put("flag", "4");
|
||||
JSONArray ret = WQL.getWO("QPDM_PRODUCTPLANPROC").addParamMap(map).process().getResultJSONArray(0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void createDay(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
|
||||
Long deptId = currentUser.getDeptId();
|
||||
WQLObject pdm_bi_productdeptpcsn = WQLObject.getWQLObject("pdm_bi_productdeptpcsn");
|
||||
WQLObject MPS_BD_ProductDailyPlan = WQLObject.getWQLObject("MPS_BD_ProductDailyPlan");
|
||||
WQLObject MD_ME_ProducMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt"); // 工艺路线主表
|
||||
// 插入主表
|
||||
json.put("dailyplan_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
String workorder_code = CodeUtil.getNewCode("R_CODE");
|
||||
json.put("plan_code", workorder_code);
|
||||
json.put("weight_unit_id", "1");
|
||||
json.put("weight_unit_name", "千克\\公斤");
|
||||
json.put("status", "01");
|
||||
json.put("create_id", currentUserId);
|
||||
json.put("create_name", nickName);
|
||||
json.put("create_time", now);
|
||||
|
||||
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+json.getString("material_id")+"'").uniqueResult(0);
|
||||
double standard_weight = mater.getDouble("standard_weight_pft");
|
||||
if(standard_weight ==0){
|
||||
throw new BadRequestException("配粉桶标准重量不能为0!");
|
||||
}
|
||||
json.put("product_num", NumberUtil.round(json.getDouble("product_weight")/standard_weight,0));
|
||||
|
||||
|
||||
JSONObject product = pdm_bi_productdeptpcsn.query("org_code='"+json.getString("plan_org_code")+"'").uniqueResult(0);
|
||||
|
||||
json.put("plan_org_name", product.getString("org_name"));
|
||||
|
||||
json.put("product_series", json.getString("product_series_id"));
|
||||
json.put("planend_date", now.substring(0,10));
|
||||
MPS_BD_ProductDailyPlan.insert(json);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
[交易说明]
|
||||
交易名: 月度计划分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.product_type_name TYPEAS s_string
|
||||
输入.plan_month TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.task_code TYPEAS s_string
|
||||
输入.status TYPEAS s_string
|
||||
输入.plan_code TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.device_id TYPEAS s_string
|
||||
输入.workorder_type TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
pp.*,
|
||||
ext.old_mark,
|
||||
ext.product_series AS mater_product_series,
|
||||
ext.standard_weight_pft AS standard_weight,
|
||||
materialbase.material_code,
|
||||
deviceinfo.device_code,
|
||||
productdeptpcsn.org_id
|
||||
FROM
|
||||
MPS_BD_ProductDailyPlan pp
|
||||
LEFT JOIN pdm_bi_productdeptpcsn productdeptpcsn ON productdeptpcsn.org_code = pp.plan_org_code
|
||||
LEFT JOIN MD_ME_ProducMaterialExt ext ON pp.material_id = ext.material_id
|
||||
LEFT JOIN md_me_materialbase materialbase ON pp.material_id = materialbase.material_id
|
||||
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = pp.device_id
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.status <> ""
|
||||
pp.status = 输入.status
|
||||
ENDOPTION
|
||||
OPTION 输入.workorder_type <> ""
|
||||
pp.workorder_type = 输入.workorder_type
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
pp.planstart_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
pp.planstart_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
(materialbase.material_code like 输入.material_code or materialbase.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
OPTION 输入.plan_code <> ""
|
||||
pp.plan_code = 输入.plan_code
|
||||
ENDOPTION
|
||||
OPTION 输入.device_id <> ""
|
||||
pp.device_id = 输入.device_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
pp.*,
|
||||
ext.old_mark,
|
||||
ext.product_series AS mater_product_series,
|
||||
ext.standard_weight_pft AS standard_weight,
|
||||
materialbase.material_code,
|
||||
deviceinfo.device_code,
|
||||
classstandard.class_name AS product_series_name,
|
||||
classstandard2.class_name AS mater_product_series_name,
|
||||
productdeptpcsn.org_id
|
||||
FROM
|
||||
MPS_BD_ProductDailyPlan pp
|
||||
LEFT JOIN pdm_bi_productdeptpcsn productdeptpcsn ON productdeptpcsn.org_code = pp.plan_org_code
|
||||
LEFT JOIN MD_ME_ProducMaterialExt ext ON pp.material_id = ext.material_id
|
||||
LEFT JOIN md_me_materialbase materialbase ON pp.material_id = materialbase.material_id
|
||||
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = pp.device_id
|
||||
LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = pp.product_series_id
|
||||
LEFT JOIN md_pb_classstandard classstandard2 ON classstandard2.class_id = ext.product_series
|
||||
WHERE
|
||||
|
||||
1=1
|
||||
OPTION 输入.status <> ""
|
||||
pp.status = 输入.status
|
||||
ENDOPTION
|
||||
OPTION 输入.workorder_type <> ""
|
||||
pp.workorder_type = 输入.workorder_type
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
pp.planstart_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
pp.planstart_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
(materialbase.material_code like 输入.material_code or materialbase.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
OPTION 输入.plan_code <> ""
|
||||
pp.plan_code = 输入.plan_code
|
||||
ENDOPTION
|
||||
OPTION 输入.device_id <> ""
|
||||
pp.device_id = 输入.device_id
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
deviceinfo.device_id AS id,
|
||||
deviceinfo.device_code AS CODE,
|
||||
deviceinfo.device_name AS NAME
|
||||
FROM
|
||||
em_bi_deviceinfo deviceinfo
|
||||
WHERE
|
||||
1 = 1
|
||||
AND deviceinfo.is_active = '1'
|
||||
AND deviceinfo.is_delete = '0'
|
||||
AND deviceinfo.workprocedure_code = 'GX003'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
capacitytemplatemst.captemplate_id AS id,
|
||||
capacitytemplatemst.captemplate_code AS CODE,
|
||||
capacitytemplatemst.captemplate_name AS NAME
|
||||
FROM
|
||||
mps_bd_capacitytemplatemst capacitytemplatemst
|
||||
WHERE
|
||||
1 = 1
|
||||
AND capacitytemplatemst.is_used = '1'
|
||||
AND capacitytemplatemst.is_delete = '0'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
[交易说明]
|
||||
交易名: 月度计划分页查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.product_type_name TYPEAS s_string
|
||||
输入.plan_month TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.task_code TYPEAS s_string
|
||||
输入.is_proc TYPEAS s_string
|
||||
输入.plan_org_code TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.device_id TYPEAS s_string
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
IF 输入.flag = "1"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
pp.*,
|
||||
ext.old_mark,
|
||||
ext.standard_weight_pft AS standard_weight
|
||||
FROM
|
||||
PCS_IF_ProductPlanProc pp
|
||||
LEFT JOIN MD_ME_ProducMaterialExt ext ON pp.material_id = ext.material_id
|
||||
WHERE
|
||||
1=1
|
||||
OPTION 输入.is_proc <> ""
|
||||
pp.is_proc = 输入.is_proc
|
||||
ENDOPTION
|
||||
OPTION 输入.plan_month <> ""
|
||||
pp.plan_month = 输入.plan_month
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
pp.plan_finish_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
pp.plan_finish_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
(pp.material_code like 输入.material_code or pp.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
OPTION 输入.plan_org_code <> ""
|
||||
pp.plan_org_code = 输入.plan_org_code
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
PAGEQUERY
|
||||
SELECT
|
||||
pp.*, ext.old_mark,
|
||||
ext.standard_weight_pft AS standard_weight,
|
||||
materialbase.material_type_id,
|
||||
ext.product_series,
|
||||
deviceinfo.device_id,
|
||||
deviceinfo.device_code
|
||||
FROM
|
||||
PCS_IF_ProductPlanProc pp
|
||||
LEFT JOIN MD_ME_ProducMaterialExt ext ON pp.material_id = ext.material_id
|
||||
LEFT JOIN md_me_materialbase materialbase ON pp.material_id = materialbase.material_id
|
||||
LEFT JOIN MPS_BD_CapacityTemplateWorkDevice WorkDevice ON (
|
||||
WorkDevice.captemplate_id = '1534741977764073472'
|
||||
AND WorkDevice.workprocedure_id = '1472449923327856640'
|
||||
AND WorkDevice.product_series_id = ext.product_series
|
||||
)
|
||||
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = WorkDevice.device_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND pp.is_proc IN ('1', '2')
|
||||
OPTION 输入.is_proc <> ""
|
||||
pp.is_proc = 输入.is_proc
|
||||
ENDOPTION
|
||||
OPTION 输入.device_id <> ""
|
||||
deviceinfo.device_id = 输入.device_id
|
||||
ENDOPTION
|
||||
OPTION 输入.plan_month <> ""
|
||||
pp.plan_month = 输入.plan_month
|
||||
ENDOPTION
|
||||
OPTION 输入.begin_time <> ""
|
||||
pp.plan_finish_date >= 输入.begin_time
|
||||
ENDOPTION
|
||||
OPTION 输入.end_time <> ""
|
||||
pp.plan_finish_date <= 输入.end_time
|
||||
ENDOPTION
|
||||
OPTION 输入.material_code <> ""
|
||||
(pp.material_code like 输入.material_code or pp.material_name like 输入.material_code)
|
||||
ENDOPTION
|
||||
OPTION 输入.task_code <> ""
|
||||
pp.task_code like 输入.task_code
|
||||
ENDOPTION
|
||||
OPTION 输入.plan_org_code <> ""
|
||||
pp.plan_org_code = 输入.plan_org_code
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDPAGEQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "3"
|
||||
QUERY
|
||||
SELECT
|
||||
deviceinfo.device_id AS id,
|
||||
deviceinfo.device_code AS CODE,
|
||||
deviceinfo.device_name AS NAME
|
||||
FROM
|
||||
em_bi_deviceinfo deviceinfo
|
||||
WHERE
|
||||
1 = 1
|
||||
AND deviceinfo.is_active = '1'
|
||||
AND deviceinfo.is_delete = '0'
|
||||
AND deviceinfo.workprocedure_code = 'GX003'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
capacitytemplatemst.captemplate_id AS id,
|
||||
capacitytemplatemst.captemplate_code AS CODE,
|
||||
capacitytemplatemst.captemplate_name AS NAME
|
||||
FROM
|
||||
mps_bd_capacitytemplatemst capacitytemplatemst
|
||||
WHERE
|
||||
1 = 1
|
||||
AND capacitytemplatemst.is_used = '1'
|
||||
AND capacitytemplatemst.is_delete = '0'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
sum( ProductProcessRouteDtl.plan_time ) AS total_plan_time
|
||||
FROM
|
||||
PDM_BI_ProductProcessRouteDtl ProductProcessRouteDtl
|
||||
LEFT JOIN PDM_BI_ProductProcessRoute ProductProcessRoute ON ProductProcessRoute.productprocess_id = ProductProcessRouteDtl.productprocess_id
|
||||
WHERE
|
||||
1 = 1
|
||||
AND ProductProcessRoute.is_delete = '0'
|
||||
AND ProductProcessRoute.productprocess_status = '20'
|
||||
OPTION 输入.material_code <> ""
|
||||
ProductProcessRoute.material_id = 输入.material_code
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
@@ -216,9 +216,19 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void changeActive(JSONObject json) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getNickName();
|
||||
String now = DateUtil.now();
|
||||
String is_active = "1";
|
||||
if (StrUtil.equals("1", json.getString("is_active"))) {
|
||||
is_active = "0";
|
||||
json.put("confirm_optid", "");
|
||||
json.put("confirm_optname", "");
|
||||
json.put("confirm_time", "");
|
||||
} else {
|
||||
json.put("confirm_optid", currentUserId);
|
||||
json.put("confirm_optname", nickName);
|
||||
json.put("confirm_time", now);
|
||||
}
|
||||
json.put("is_active", is_active);
|
||||
WQLObject.getWQLObject("EM_BI_DeviceRepairPlanMst").update(json);
|
||||
|
||||
64
mes/qd/src/api/wms/pdm/dailyplan.js
Normal file
64
mes/qd/src/api/wms/pdm/dailyplan.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/dailyplan',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/dailyplan/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/dailyplan',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function importExcel(id) {
|
||||
return request({
|
||||
url: 'api/dailyplan/importExcel/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function submit(data) {
|
||||
return request({
|
||||
url: 'api/dailyplan/submit',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function submit2(data) {
|
||||
return request({
|
||||
url: 'api/dailyplan/submit2',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getDevices() {
|
||||
return request({
|
||||
url: 'api/dailyplan/getDevices',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getCapacitytes(params) {
|
||||
return request({
|
||||
url: 'api/dailyplan/getCapacitytes',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, importExcel, getCapacitytes, submit, getDevices, submit2 }
|
||||
64
mes/qd/src/api/wms/pdm/producetask.js
Normal file
64
mes/qd/src/api/wms/pdm/producetask.js
Normal file
@@ -0,0 +1,64 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/producetask',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/producetask/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/producetask',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function importExcel(id) {
|
||||
return request({
|
||||
url: 'api/producetask/importExcel/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function submit(data) {
|
||||
return request({
|
||||
url: 'api/producetask/submit',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function submit2(data) {
|
||||
return request({
|
||||
url: 'api/producetask/submit2',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getDevices() {
|
||||
return request({
|
||||
url: 'api/producetask/getDevices',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getCapacitytes(params) {
|
||||
return request({
|
||||
url: 'api/producetask/getCapacitytes',
|
||||
method: 'get',
|
||||
params
|
||||
})
|
||||
}
|
||||
export default { add, edit, del, importExcel, getCapacitytes, submit, getDevices, submit2 }
|
||||
230
mes/qd/src/views/wms/pdm/produce/dailyplan/AddDialog.vue
Normal file
230
mes/qd/src/views/wms/pdm/produce/dailyplan/AddDialog.vue
Normal file
@@ -0,0 +1,230 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
title="日计划编辑"
|
||||
width="800px"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
@close="close"
|
||||
>
|
||||
<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="115px" label-suffix=":">
|
||||
<el-form-item label="日计划编码" prop="plan_code">
|
||||
<label slot="label">日计划编码:</label>
|
||||
<el-input v-model="form.plan_code" disabled placeholder="系统生成" clearable style="width: 210px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划生产日期" prop="planstart_date">
|
||||
<el-date-picker v-model="form.planstart_date" value-format="yyyy-MM-dd" type="date" placeholder="选择开始时间" style="width: 210px" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计划类型" prop="workorder_type">
|
||||
<el-select
|
||||
v-model="form.workorder_type"
|
||||
placeholder="计划类型"
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
disabled
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.workorder_type2"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交货日期" prop="plan_finish_date">
|
||||
<el-date-picker v-model="form.plan_finish_date" value-format="yyyy-MM-dd" type="date" style="width: 210px" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品" prop="material_code">
|
||||
<label slot="label">产品:</label>
|
||||
<el-input v-model="form.material_code" style="width: 210px" disabled class="input-with-select">
|
||||
<el-button slot="append" icon="el-icon-search" @click="queryMater" />
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="系列" prop="product_series_id">
|
||||
<el-select
|
||||
v-model="form.product_series_id"
|
||||
placeholder=""
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in XLList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="申报单位" prop="plan_org_code">
|
||||
<el-select
|
||||
v-model="form.plan_org_code"
|
||||
placeholder=""
|
||||
style="width: 210px"
|
||||
class="filter-item"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in Depts"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="重量" prop="product_weight">
|
||||
<label slot="label">重量(KG):</label>
|
||||
<el-input-number
|
||||
v-model="form.product_weight"
|
||||
:controls="false"
|
||||
:precision="3"
|
||||
:min="1"
|
||||
:disabled="crud.status.view > 0"
|
||||
style="width: 210px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键设备" prop="device_id">
|
||||
<label slot="label">关键设备:</label>
|
||||
<el-select
|
||||
v-model="form.device_id"
|
||||
size="mini"
|
||||
placeholder="关键设备"
|
||||
class="filter-item"
|
||||
style="width: 210px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in Devices"
|
||||
:key="item.id"
|
||||
:label="item.code"
|
||||
:value="item.id"
|
||||
/></el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<label slot="label">备 注:</label>
|
||||
<el-input v-model="form.remark" style="width: 480px;" rows="3" type="textarea" :disabled="crud.status.view > 0" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<DeviceDialog :dialog-show.sync="dtlShow" @tableChanged="tableChanged" />
|
||||
<MaterDialog :dialog-show.sync="materShow" :mater-opt-code.sync="materType" @tableChanged2="tableChanged2" />
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button slot="left" type="info" @click="crud.cancelCU">关闭</el-button>
|
||||
<el-button slot="left" type="primary" :loading="crud.cu === 2" @click="crud.submitCU">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CRUD, { crud, form } from '@crud/crud'
|
||||
import DeviceDialog from '@/views/wms/pub/DeviceDialog'
|
||||
import MaterDialog from '@/views/wms/pub/MaterDialog'
|
||||
import workorder from '@/api/wms/pdm/workorder'
|
||||
import crudseriesProcessRoute from '@/api/wms/pdm/seriesProcessRoute'
|
||||
import producetask from '@/api/wms/pdm/producetask'
|
||||
import Date from '@/utils/datetime'
|
||||
|
||||
const defaultForm = {
|
||||
plan_code: '',
|
||||
material_code: '',
|
||||
material_id: '',
|
||||
device_name: '',
|
||||
device_id: '',
|
||||
plan_org_code: '',
|
||||
plan_org_name: '',
|
||||
status: '10',
|
||||
product_series_id: '',
|
||||
product_weight: '500',
|
||||
workorder_type: '02',
|
||||
remark: '',
|
||||
plan_finish_date: new Date().daysLater(5),
|
||||
planstart_date: new Date().daysLater(5)
|
||||
}
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
components: { DeviceDialog, MaterDialog },
|
||||
mixins: [crud(), form(defaultForm)],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
dicts: ['workorder_status', 'workorder_type2', 'product_series'],
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
dtlShow: false,
|
||||
materType: '05',
|
||||
XLList: [],
|
||||
Depts: [],
|
||||
Devices: [],
|
||||
materShow: false,
|
||||
rules: {
|
||||
plan_finish_date: [
|
||||
{ required: true, message: '交货日期不能为空', trigger: 'blur' }
|
||||
],
|
||||
planstart_date: [
|
||||
{ required: true, message: '计划生产日期不能为空', trigger: 'blur' }
|
||||
],
|
||||
workorder_type: [
|
||||
{ required: true, message: '计划类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
plan_org_code: [
|
||||
{ required: true, message: '申报单位不能为空', trigger: 'blur' }
|
||||
],
|
||||
material_code: [
|
||||
{ required: true, message: '产品不能为空', trigger: 'blur' }
|
||||
],
|
||||
product_series_id: [
|
||||
{ required: true, message: '系列不能为空', trigger: 'blur' }
|
||||
],
|
||||
product_weight: [
|
||||
{ required: true, message: '重量不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
crudseriesProcessRoute.getXLlist2().then(res => {
|
||||
this.XLList = res
|
||||
})
|
||||
workorder.getDepts().then(res => {
|
||||
this.Depts = res
|
||||
})
|
||||
producetask.getDevices().then(res => {
|
||||
this.Devices = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.$emit('AddChanged')
|
||||
},
|
||||
async queryMater(index, row) {
|
||||
this.materShow = true
|
||||
},
|
||||
tableChanged2(row) {
|
||||
this.form.material_id = row.material_id
|
||||
this.form.material_code = row.material_code
|
||||
this.form.product_series_id = row.product_series
|
||||
this.form.weight_unit_id = row.base_unit_id
|
||||
this.form.weight_unit_name = row.base_unit_id_name
|
||||
this.form.pcsn = ''
|
||||
},
|
||||
tableChanged(row) {
|
||||
this.form.device_id = row.device_id
|
||||
this.form.device_name = row.device_name
|
||||
},
|
||||
[CRUD.HOOK.beforeSubmit]() {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.input-with-select {
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
||||
345
mes/qd/src/views/wms/pdm/produce/dailyplan/index.vue
Normal file
345
mes/qd/src/views/wms/pdm/produce/dailyplan/index.vue
Normal file
@@ -0,0 +1,345 @@
|
||||
<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="90px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="开始日期">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@input="onInput()"
|
||||
@change="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键设备">
|
||||
<label slot="label">关键设备:</label>
|
||||
<el-select
|
||||
v-model="query.device_id"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="关键设备"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in Devices"
|
||||
:key="item.id"
|
||||
:label="item.code"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="日计划编号">
|
||||
<el-input
|
||||
v-model="query.plan_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入日计划编号"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="query.status"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="状态"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@change="MyQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.planstatus"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品">
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入物料编码"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计划类型">
|
||||
<el-select
|
||||
v-model="query.workorder_type"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="计划类型"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@change="MyQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.workorder_type2"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<rrOperation />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="save()"
|
||||
>
|
||||
重排
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="downdtl()"
|
||||
>
|
||||
导出excel
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="createWork()"
|
||||
>
|
||||
生成工令
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column
|
||||
v-permission="['admin','workorder:del','workorder:edit']"
|
||||
min-width="130"
|
||||
label="操作"
|
||||
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 type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||
<el-table-column prop="plan_code" label="日计划编码" width="120" />
|
||||
<el-table-column :formatter="seriesFormat" min-width="80" prop="product_series_id" label="系列产线" />
|
||||
<el-table-column prop="device_code" label="关键设备" width="100" />
|
||||
<el-table-column prop="planstart_date" label="计划开始日期" width="100" />
|
||||
<el-table-column prop="plan_org_name" label="申报单位" width="100" />
|
||||
<el-table-column prop="workorder_type" label="计划类型" :formatter="workorder_typeFormat" min-width="120" />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="120"/>
|
||||
<el-table-column prop="old_mark" label="牌号" />
|
||||
<el-table-column :formatter="seriesFormat" min-width="80" prop="mater_product_series" label="产品系列" />
|
||||
<el-table-column prop="product_weight" label="生产重量(kg)" :formatter="crud.formatNum3" min-width="120" />
|
||||
<el-table-column prop="planend_date" label="计划结束日期" width="100" />
|
||||
<el-table-column prop="plan_finish_date" label="交货日期" width="100" />
|
||||
<el-table-column prop="day_num" label="提前天数" width="90" :formatter="crud.formatNum0" />
|
||||
<el-table-column :formatter="stateFormat" min-width="80" prop="status" label="状态" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="140px" />
|
||||
<el-table-column prop="create_name" label="创建人" width="100" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog @AddChanged="querytable" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import producetask from '@/api/wms/pdm/producetask'
|
||||
import dailyplan from '@/api/wms/pdm/dailyplan'
|
||||
import AddDialog from '@/views/wms/pdm/produce/dailyplan/AddDialog'
|
||||
import CRUD, { presenter, header, crud } 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 { getToken } from '@/utils/auth'
|
||||
import { mapGetters } from 'vuex'
|
||||
import workorder from '@/api/wms/pdm/workorder'
|
||||
import crudseriesProcessRoute from '@/api/wms/pdm/seriesProcessRoute'
|
||||
import { download } from '@/api/data'
|
||||
import { downloadFile } from '@/utils'
|
||||
|
||||
export default {
|
||||
name: 'dailyplan',
|
||||
dicts: ['product_mode', 'workorder_type2', 'planstatus'],
|
||||
components: { crudOperation, rrOperation, udOperation, AddDialog, pagination },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '日计划管理',
|
||||
url: 'api/dailyplan',
|
||||
idField: 'dailyplan_id',
|
||||
sort: 'dailyplan_id',
|
||||
query: { device_id: '' },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: false
|
||||
}})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: { 'Authorization': getToken() },
|
||||
permission: {
|
||||
add: ['admin', 'workorder:add'],
|
||||
edit: ['admin', 'workorder:edit'],
|
||||
del: ['admin', 'workorder:del']
|
||||
},
|
||||
dialogVisible: false,
|
||||
save_flag: true,
|
||||
sub_flag: true,
|
||||
Depts: [],
|
||||
Devices: [],
|
||||
Capacitytes: [],
|
||||
XLList: [],
|
||||
fileList: [],
|
||||
checkrows: [],
|
||||
rules: {
|
||||
}}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'baseApi',
|
||||
'fileUploadApi'
|
||||
])
|
||||
},
|
||||
created() {
|
||||
workorder.getDepts().then(res => {
|
||||
this.Depts = res
|
||||
})
|
||||
|
||||
producetask.getDevices().then(res => {
|
||||
this.Devices = res
|
||||
})
|
||||
crudseriesProcessRoute.getXLlist2().then(res => {
|
||||
this.XLList = res
|
||||
})
|
||||
producetask.getCapacitytes().then(res => {
|
||||
this.Capacitytes = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
checkboxT(row) {
|
||||
return row.status === '01'
|
||||
},
|
||||
canUd(row) {
|
||||
return row.status !== '01'
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
stateFormat(row) {
|
||||
return this.dict.label.planstatus[row.status]
|
||||
},
|
||||
workorder_typeFormat(row) {
|
||||
return this.dict.label.workorder_type2[row.workorder_type]
|
||||
},
|
||||
onInput() {
|
||||
this.$forceUpdate()
|
||||
},
|
||||
MyQuery(value) {
|
||||
if (value === '1') {
|
||||
this.save_flag = false
|
||||
} else {
|
||||
this.save_flag = true
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
seriesFormat(row) {
|
||||
for (const item of this.XLList) {
|
||||
if (item.id === row.product_series) {
|
||||
return item.name
|
||||
}
|
||||
}
|
||||
},
|
||||
save() {
|
||||
this.checkrows = this.$refs.table.data
|
||||
if (this.checkrows.length === 0) {
|
||||
this.crud.notify('重排记录数不能为0!')
|
||||
return false
|
||||
}
|
||||
if(this.crud.query.device_id === '' || this.crud.query.device_id === undefined ){
|
||||
this.crud.notify('请先选择关键设备!')
|
||||
return false
|
||||
}
|
||||
/* dailyplan.submit2({ query: this.crud.query, rows: this.checkrows} ).then(res => {
|
||||
this.crud.notify('操作成功!')
|
||||
this.querytable()
|
||||
})*/
|
||||
this.crud.notify('操作成功!')
|
||||
this.querytable()
|
||||
},
|
||||
downdtl() {
|
||||
crud.downloadLoading = true
|
||||
download('/api/dailyplan/download', this.crud.query).then(result => {
|
||||
downloadFile(result, '日计划', 'xlsx')
|
||||
crud.downloadLoading = false
|
||||
}).catch(() => {
|
||||
crud.downloadLoading = false
|
||||
})
|
||||
},
|
||||
createWork() {
|
||||
this.checkrows = this.$refs.table.selection
|
||||
if (this.checkrows.length === 0) {
|
||||
this.crud.notify('请勾选需要操作的记录!')
|
||||
return false
|
||||
}
|
||||
dailyplan.submit({ query: this.crud.query, rows: this.checkrows }).then(res => {
|
||||
this.crud.notify('操作成功!')
|
||||
this.querytable()
|
||||
})
|
||||
},
|
||||
querytable() {
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
315
mes/qd/src/views/wms/pdm/produce/mouthtask/index.vue
Normal file
315
mes/qd/src/views/wms/pdm/produce/mouthtask/index.vue
Normal file
@@ -0,0 +1,315 @@
|
||||
<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="计划月份">
|
||||
<label slot="label">计划月份:</label>
|
||||
<el-date-picker
|
||||
v-model="query.plan_month"
|
||||
type="month"
|
||||
style="width: 200px"
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
value-format="yyyyMM"
|
||||
placeholder="选择年月"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="关键设备">
|
||||
<label slot="label">关键设备:</label>
|
||||
<el-select
|
||||
v-model="query.device_id"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="关键设备"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in Devices"
|
||||
:key="item.id"
|
||||
:label="item.code"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申报单位">
|
||||
<label slot="label">申报单位:</label>
|
||||
<el-select
|
||||
v-model="query.plan_org_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="申报单位"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in Depts"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品">
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入物料编码"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="query.is_proc"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="状态"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@change="MyQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.is_proc2"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="任务号">
|
||||
<el-input
|
||||
v-model="query.task_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入任务号"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="排产模板">
|
||||
<label slot="label">排产模板:</label>
|
||||
<el-select
|
||||
v-model="query.captemplate_id"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="排产模板"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in Capacitytes"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="初始日期">
|
||||
<label slot="label">初始日期:</label>
|
||||
<el-date-picker
|
||||
v-model="query.nowstart_date"
|
||||
type="date"
|
||||
style="width: 200px"
|
||||
placeholder="选择日期">
|
||||
</el-date-picker>
|
||||
<el-checkbox v-model="query.checked">启用</el-checkbox>
|
||||
<rrOperation />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="save()"
|
||||
>
|
||||
预排
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||
<el-table-column prop="plan_month" label="计划月份" />
|
||||
<el-table-column prop="task_code" label="任务号" />
|
||||
<el-table-column prop="plan_org_name" label="申报单位" width="100" />
|
||||
<el-table-column prop="device_code" label="关键设备" width="100" />
|
||||
<el-table-column prop="plan_finish_date" label="交货日期" width="90" />
|
||||
<el-table-column prop="old_mark" label="牌号" />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="150"/>
|
||||
<el-table-column :formatter="seriesFormat" min-width="80" prop="product_series" label="系列" />
|
||||
<el-table-column prop="product_type_name" label="生产方式" />
|
||||
<el-table-column prop="fact_weight" label="生产重量(t)" :formatter="pcsn_num_format2" min-width="90" />
|
||||
<el-table-column prop="standard_weight" label="每批重量kg" width="90" :formatter="crud.formatNum3"/>
|
||||
<el-table-column prop="pcsn_num" label="批数" :formatter="pcsn_num_format"/>
|
||||
<el-table-column :formatter="stateFormat" min-width="80" prop="is_proc" label="状态" />
|
||||
<el-table-column prop="update_time" label="提交时间" width="140px" />
|
||||
<el-table-column prop="update_optname" label="提交人" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import producetask from '@/api/wms/pdm/producetask'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { mapGetters } from 'vuex'
|
||||
import workorder from '@/api/wms/pdm/workorder'
|
||||
import crudseriesProcessRoute from '@/api/wms/pdm/seriesProcessRoute'
|
||||
import Date from '@/utils/datetime'
|
||||
|
||||
export default {
|
||||
name: 'mouthtask',
|
||||
dicts: ['product_mode', 'is_proc2'],
|
||||
components: { pagination, crudOperation, rrOperation },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '月计划管理',
|
||||
url: 'api/producetask/mouthtask',
|
||||
idField: 'plan_id',
|
||||
sort: '',
|
||||
query:{ nowstart_date: new Date(), captemplate_id: '',is_proc: '1'},
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: false
|
||||
}})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: { 'Authorization': getToken() },
|
||||
dialogVisible: false,
|
||||
save_flag: true,
|
||||
sub_flag: true,
|
||||
Depts: [],
|
||||
Devices: [],
|
||||
Capacitytes: [],
|
||||
XLList: [],
|
||||
fileList: [],
|
||||
checkrows: [],
|
||||
rules: {
|
||||
}}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'baseApi',
|
||||
'fileUploadApi'
|
||||
])
|
||||
},
|
||||
created() {
|
||||
workorder.getDepts().then(res => {
|
||||
this.Depts = res
|
||||
})
|
||||
|
||||
producetask.getDevices().then(res => {
|
||||
this.Devices = res
|
||||
})
|
||||
crudseriesProcessRoute.getXLlist2().then(res => {
|
||||
this.XLList = res
|
||||
})
|
||||
producetask.getCapacitytes().then(res => {
|
||||
this.Capacitytes = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
if (this.crud.query.is_proc === '0') {
|
||||
this.save_flag = false
|
||||
} else {
|
||||
this.save_flag = true
|
||||
}
|
||||
return true
|
||||
},
|
||||
checkboxT(row) {
|
||||
return row.is_proc === '1'
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
stateFormat(row) {
|
||||
return this.dict.label.is_proc2[row.is_proc]
|
||||
},
|
||||
pcsn_num_format(row) {
|
||||
return Math.ceil(row.fact_weight / row.standard_weight)
|
||||
},
|
||||
pcsn_num_format2(row) {
|
||||
return parseFloat(row.fact_weight / 1000.0).toFixed(3)
|
||||
},
|
||||
onInput() {
|
||||
this.$forceUpdate()
|
||||
},
|
||||
MyQuery(value) {
|
||||
if (value === '1') {
|
||||
this.save_flag = false
|
||||
} else {
|
||||
this.save_flag = true
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
seriesFormat(row) {
|
||||
for (const item of this.XLList) {
|
||||
if (item.id === row.product_series) {
|
||||
return item.name
|
||||
}
|
||||
}
|
||||
},
|
||||
save() {
|
||||
if(this.crud.query.captemplate_id === '' || this.crud.query.captemplate_id === undefined ){
|
||||
this.crud.notify('请先选择排产模板!')
|
||||
return false
|
||||
}
|
||||
this.checkrows = this.$refs.table.selection
|
||||
if(this.checkrows.length === 0 ){
|
||||
this.crud.notify('请勾选需要提交的记录!')
|
||||
return false
|
||||
}
|
||||
producetask.submit2({ query: this.crud.query, rows: this.checkrows}).then(res => {
|
||||
this.crud.notify('操作成功!')
|
||||
this.querytable()
|
||||
})
|
||||
},
|
||||
querytable() {
|
||||
this.crud.toQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
389
mes/qd/src/views/wms/pdm/produce/producetask/index.vue
Normal file
389
mes/qd/src/views/wms/pdm/produce/producetask/index.vue
Normal file
@@ -0,0 +1,389 @@
|
||||
<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="计划月份">
|
||||
<label slot="label">计划月份:</label>
|
||||
<el-date-picker
|
||||
v-model="query.plan_month"
|
||||
type="month"
|
||||
style="width: 200px"
|
||||
size="mini"
|
||||
class="filter-item"
|
||||
value-format="yyyyMM"
|
||||
placeholder="选择年月"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="申报单位">
|
||||
<label slot="label">申报单位:</label>
|
||||
<el-select
|
||||
v-model="query.plan_org_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="申报单位"
|
||||
class="filter-item"
|
||||
style="width: 200px"
|
||||
@change="hand"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in Depts"
|
||||
:key="item.code"
|
||||
:label="item.name"
|
||||
:value="item.code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="交货日期">
|
||||
<el-date-picker
|
||||
v-model="query.createTime"
|
||||
type="daterange"
|
||||
value-format="yyyy-MM-dd"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@input="onInput()"
|
||||
@change="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品">
|
||||
<el-input
|
||||
v-model="query.material_code"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="请输入物料编码"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="query.is_proc"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="状态"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
@change="MyQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dict.is_proc"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<rrOperation />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="success"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
@click="open"
|
||||
>
|
||||
导入Excel
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="save_flag"
|
||||
@click="submit()"
|
||||
>
|
||||
保存
|
||||
</el-button>
|
||||
<el-button
|
||||
slot="right"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
icon="el-icon-position"
|
||||
size="mini"
|
||||
:disabled="sub_flag"
|
||||
@click="save()"
|
||||
>
|
||||
提交
|
||||
</el-button>
|
||||
</crudOperation>
|
||||
|
||||
<!-- 文件上传弹出框-->
|
||||
<el-dialog
|
||||
title="提示"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
:before-close="handleClose"
|
||||
>
|
||||
<el-upload
|
||||
ref="upload"
|
||||
:limit="1"
|
||||
:before-upload="beforeUpload"
|
||||
:auto-upload="false"
|
||||
:headers="headers"
|
||||
:file-list="fileList"
|
||||
:on-success="handleSuccess"
|
||||
:on-error="handleError"
|
||||
:on-exceed="handleExceed"
|
||||
:action="nowAction"
|
||||
>
|
||||
<div class="eladmin-upload"><i class="el-icon-upload" /> 添加文件</div>
|
||||
<div slot="tip" class="el-upload__tip">可上传任意格式文件,且不超过100M</div>
|
||||
</el-upload>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="upload">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!--表格渲染-->
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="mySelectionChange">
|
||||
<el-table-column
|
||||
v-permission="['admin','producetask:del']"
|
||||
min-width="60"
|
||||
label="操作"
|
||||
align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
:disabled-dle="canUd(scope.row)"
|
||||
:isVisiableEdit="false"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" label="序号" width="55" align="center" />
|
||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||
<el-table-column prop="task_code" label="任务号" width="120" />
|
||||
<el-table-column prop="plan_org_name" label="申报单位" width="100" />
|
||||
<el-table-column prop="plan_month" label="计划月份" />
|
||||
<el-table-column prop="plan_finish_date" label="交货日期" width="90" />
|
||||
<el-table-column prop="material_code" label="物料编码" min-width="150"/>
|
||||
<el-table-column prop="old_mark" label="牌号" />
|
||||
<el-table-column prop="product_type_name" label="生产方式" />
|
||||
<el-table-column prop="product_weight" label="需求重量" :formatter="crud.formatNum3"/>
|
||||
<el-table-column prop="fact_weight" label="生产重量" :formatter="crud.formatNum3" width="150" align="center">
|
||||
<template scope="scope">
|
||||
<el-input-number size="mini" v-model="scope.row.fact_weight" :disabled="save_flag" :precision="3" :controls="false" :min="1" style="width: 120px" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="weight_unit_name" label="单位"/>
|
||||
<el-table-column prop="standard_weight" label="每批重量kg" width="90" :formatter="crud.formatNum3"/>
|
||||
<el-table-column prop="pcsn_num" label="批数" :formatter="pcsn_num_format"/>
|
||||
<el-table-column :formatter="stateFormat" min-width="80" prop="is_proc" label="状态" />
|
||||
<el-table-column prop="update_time" label="提交时间" width="140px" />
|
||||
<el-table-column prop="update_optname" label="提交人" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import producetask from '@/api/wms/pdm/producetask'
|
||||
import CRUD, { presenter, header, crud } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { mapGetters } from 'vuex'
|
||||
import workorder from '@/api/wms/pdm/workorder'
|
||||
|
||||
export default {
|
||||
name: 'producetask',
|
||||
dicts: ['product_mode', 'is_proc'],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '生产任务管理',
|
||||
url: 'api/producetask',
|
||||
idField: 'plan_id',
|
||||
sort: 'plan_id,desc',
|
||||
optShow: {
|
||||
add: false,
|
||||
edit: false,
|
||||
del: true,
|
||||
download: false,
|
||||
reset: false
|
||||
}})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: { 'Authorization': getToken() },
|
||||
dialogVisible: false,
|
||||
save_flag: true,
|
||||
sub_flag: true,
|
||||
nowAction: this.baseApi + '/api/producetask/importExcel/1',
|
||||
Depts: [],
|
||||
fileList: [],
|
||||
checkrows: [],
|
||||
permission: {
|
||||
del: ['admin', 'producetask:del']
|
||||
},
|
||||
form: { name: '' },
|
||||
rules: {
|
||||
}}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'baseApi',
|
||||
'fileUploadApi'
|
||||
])
|
||||
},
|
||||
created() {
|
||||
workorder.getDepts().then(res => {
|
||||
this.Depts = res
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
if (this.crud.query.is_proc === '0') {
|
||||
this.save_flag = false
|
||||
} else {
|
||||
this.save_flag = true
|
||||
}
|
||||
return true
|
||||
},
|
||||
checkboxT(row) {
|
||||
return row.is_proc !== '2'
|
||||
},
|
||||
canUd(row) {
|
||||
return row.is_proc === '2'
|
||||
},
|
||||
mySelectionChange(rows) {
|
||||
this.buttonChange(rows)
|
||||
},
|
||||
buttonChange(rows) {
|
||||
if (rows.length !== 0) {
|
||||
this.sub_flag = false
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (rows[i].is_proc !== '0') {
|
||||
this.sub_flag = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.handleCurrentChange()
|
||||
}
|
||||
},
|
||||
hand(value) {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
beforeUpload(file) {
|
||||
let isLt2M = true
|
||||
isLt2M = file.size / 1024 / 1024 < 100
|
||||
if (!isLt2M) {
|
||||
this.loading = false
|
||||
this.$message.error('上传文件大小不能超过 100MB!')
|
||||
}
|
||||
this.form.name = file.name
|
||||
return isLt2M
|
||||
},
|
||||
handleCurrentChange() {
|
||||
this.checkrows = []
|
||||
this.sub_flag = true
|
||||
},
|
||||
handleSuccess(response, file, fileList) {
|
||||
this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
},
|
||||
// 监听上传失败
|
||||
handleError(e, file, fileList) {
|
||||
const msg = JSON.parse(e.message)
|
||||
this.$notify({
|
||||
title: msg.message,
|
||||
type: 'error',
|
||||
duration: 2500
|
||||
})
|
||||
this.loading = false
|
||||
},
|
||||
stateFormat(row) {
|
||||
return this.dict.label.is_proc[row.is_proc]
|
||||
},
|
||||
open() {
|
||||
const a = this.fileList
|
||||
this.fileList = a.splice(0, 0)
|
||||
this.nowAction = this.baseApi + '/api/producetask/importExcel/1'
|
||||
this.dialogVisible = true
|
||||
},
|
||||
pcsn_num_format(row) {
|
||||
return Math.ceil(row.fact_weight / row.standard_weight)
|
||||
},
|
||||
onInput() {
|
||||
this.$forceUpdate()
|
||||
},
|
||||
MyQuery(value) {
|
||||
if (value === '0') {
|
||||
this.save_flag = false
|
||||
} else {
|
||||
this.save_flag = true
|
||||
}
|
||||
this.crud.toQuery()
|
||||
},
|
||||
upload() {
|
||||
this.$refs.upload.submit()
|
||||
this.dialogVisible = false
|
||||
},
|
||||
submit() {
|
||||
this.checkrows = this.$refs.table.data
|
||||
if(this.checkrows.length === 0 ){
|
||||
this.crud.notify('无可提交的记录!')
|
||||
return false
|
||||
}
|
||||
producetask.submit({'status': '0', rows: this.checkrows}).then(res => {
|
||||
this.crud.notify('操作成功!')
|
||||
this.querytable()
|
||||
})
|
||||
},
|
||||
save() {
|
||||
this.checkrows = this.$refs.table.selection
|
||||
if(this.checkrows.length === 0 ){
|
||||
this.crud.notify('请勾选需要提交的记录!')
|
||||
return false
|
||||
}
|
||||
producetask.submit({'status': '1', rows: this.checkrows}).then(res => {
|
||||
this.crud.notify('操作成功!')
|
||||
this.querytable()
|
||||
})
|
||||
},
|
||||
querytable() {
|
||||
this.crud.toQuery()
|
||||
},
|
||||
handleExceed(files, fileList) {
|
||||
this.$message.warning('当前限制只能选择 1 个文件')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -111,6 +111,8 @@
|
||||
<el-table-column prop="device_name" label="设备名称" show-overflow-tooltip />
|
||||
<el-table-column prop="maintenancecycle" label="维修周期" :formatter="formatMainName" />
|
||||
<el-table-column prop="plan_start_date" label="计划开始日期" width="120px" />
|
||||
<el-table-column prop="real_start_date" label="实际开始日期" width="120px" />
|
||||
<el-table-column prop="real_end_date" label="实际结束日期" width="120px" />
|
||||
<el-table-column prop="create_name" label="创建人" />
|
||||
<el-table-column prop="create_time" label="创建时间" width="150px" />
|
||||
<el-table-column prop="confirm_optname" label="审核人" />
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
<el-table-column prop="device_name" label="设备名称" />
|
||||
<el-table-column prop="maintenancecycle" label="保养周期" :formatter="formatMainName"/>
|
||||
<el-table-column prop="plan_start_date" label="计划开始日期" width="150px" />
|
||||
<el-table-column prop="real_start_date" label="实际开始日期" width="150px" />
|
||||
<el-table-column prop="real_end_date" label="实际结束日期" width="150px" />
|
||||
<el-table-column prop="remark" label="备注" />
|
||||
<el-table-column prop="create_name" label="创建人姓名" />
|
||||
|
||||
Reference in New Issue
Block a user