物料同步修改 工单同步添加 工单完成反馈
This commit is contained in:
@@ -186,6 +186,7 @@ public class MaterialbaseServiceImpl implements MaterialbaseService {
|
|||||||
return MaterOptTypeEnum.getObj(materOpt_code);
|
return MaterOptTypeEnum.getObj(materOpt_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void synchronize(JSONObject param) {
|
public void synchronize(JSONObject param) {
|
||||||
// 获取 mes 地址,拼接请求地址
|
// 获取 mes 地址,拼接请求地址
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ package org.nl.wms.ext.acs.service.impl;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.RedisUtils;
|
import org.nl.modules.common.utils.RedisUtils;
|
||||||
|
import org.nl.modules.system.service.ParamService;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.modules.wql.util.SpringContextHolder;
|
import org.nl.modules.wql.util.SpringContextHolder;
|
||||||
import org.nl.wms.basedata.service.MaterialbaseService;
|
import org.nl.wms.basedata.service.MaterialbaseService;
|
||||||
@@ -37,6 +40,7 @@ import org.nl.wms.st.structivt.service.dto.StructivtDto;
|
|||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
@@ -56,6 +60,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
private final DeviceService deviceService;
|
private final DeviceService deviceService;
|
||||||
private final WorkordeService workordeService;
|
private final WorkordeService workordeService;
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
|
private final ParamService paramService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* task_id:任务标识
|
* task_id:任务标识
|
||||||
@@ -132,6 +137,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> feedbackOrderStatus(String string) {
|
public Map<String, Object> feedbackOrderStatus(String string) {
|
||||||
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
WQLObject wo = WQLObject.getWQLObject("PDM_BD_WorkOrder");
|
||||||
@@ -161,9 +167,22 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
|||||||
wo.update(jsonObject1);
|
wo.update(jsonObject1);
|
||||||
status = "200";
|
status = "200";
|
||||||
message = "操作成功!";
|
message = "操作成功!";
|
||||||
|
|
||||||
|
// 操作成功后向 MES 反馈
|
||||||
|
JSONObject param = new JSONObject();
|
||||||
|
param.put("material_code", materialbaseService.findById(jsonObject1.getLong("material_id")).getMaterial_code());
|
||||||
|
param.put("workorder_code", jsonObject1.getString("workorder_code"));
|
||||||
|
param.put("workorder_qty", jsonObject1.getString("plan_qty"));
|
||||||
|
param.put("device_code", deviceService.findByCode(jsonObject1.getString("device_code")).getExtend_code());
|
||||||
|
String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/materialIvt";
|
||||||
|
HttpRequest
|
||||||
|
.post(workorder_uri)
|
||||||
|
.body(param.toJSONString())
|
||||||
|
.execute();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
status = "400";
|
status = "400";
|
||||||
message = "操作失败!";
|
message = "操作失败!";
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resp.put("status", status);
|
resp.put("status", status);
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package org.nl.wms.pdm.rest;
|
package org.nl.wms.pdm.rest;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.logging.annotation.Log;
|
import org.nl.modules.logging.annotation.Log;
|
||||||
import org.nl.wms.pdm.service.WorkordeService;
|
import org.nl.wms.pdm.service.WorkordeService;
|
||||||
import org.nl.wms.pdm.service.dto.WorkorderDto;
|
import org.nl.wms.pdm.service.dto.WorkorderDto;
|
||||||
@@ -142,4 +144,19 @@ public class WorkorderController {
|
|||||||
return new ResponseEntity<>(workordeService.getDtl(param),HttpStatus.OK);
|
return new ResponseEntity<>(workordeService.getDtl(param),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/synchronize")
|
||||||
|
@Log("从 MES 同步工单")
|
||||||
|
@ApiOperation("从 MES 同步工单")
|
||||||
|
public ResponseEntity<Object> synchronize(@RequestBody JSONObject param) {
|
||||||
|
String start_time = param.getString("start_time");
|
||||||
|
if (StrUtil.isEmpty(start_time)) {
|
||||||
|
throw new BadRequestException("开始日期不能为空");
|
||||||
|
}
|
||||||
|
String end_time = param.getString("end_time");
|
||||||
|
if (StrUtil.isEmpty(end_time)) {
|
||||||
|
throw new BadRequestException("结束日期不能为空");
|
||||||
|
}
|
||||||
|
workordeService.synchronize(param);
|
||||||
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,4 +121,6 @@ public interface WorkordeService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
JSONArray getDtl(JSONObject param);
|
JSONArray getDtl(JSONObject param);
|
||||||
|
|
||||||
|
void synchronize(JSONObject param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -16,6 +18,7 @@ import org.nl.modules.common.exception.BadRequestException;
|
|||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
|
|
||||||
import org.nl.modules.common.utils.dto.CurrentUser;
|
import org.nl.modules.common.utils.dto.CurrentUser;
|
||||||
|
import org.nl.modules.system.service.ParamService;
|
||||||
import org.nl.modules.system.util.CodeUtil;
|
import org.nl.modules.system.util.CodeUtil;
|
||||||
|
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
@@ -32,8 +35,10 @@ import org.springframework.data.domain.Pageable;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author qinx
|
* @author qinx
|
||||||
@@ -47,6 +52,7 @@ public class WorkorderServiceImpl implements WorkordeService {
|
|||||||
|
|
||||||
private final WmsToAcsService wmsToAcsService;
|
private final WmsToAcsService wmsToAcsService;
|
||||||
private final MaterialbaseService materialbaseService;
|
private final MaterialbaseService materialbaseService;
|
||||||
|
private final ParamService paramService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||||
@@ -127,9 +133,9 @@ public class WorkorderServiceImpl implements WorkordeService {
|
|||||||
String now = DateUtil.now();
|
String now = DateUtil.now();
|
||||||
CurrentUser currentUser = SecurityUtils.getCurrentUser();
|
CurrentUser currentUser = SecurityUtils.getCurrentUser();
|
||||||
Long deptId = currentUser.getUser().getDeptId();
|
Long deptId = currentUser.getUser().getDeptId();
|
||||||
String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
|
// String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
|
||||||
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
dto.setWorkorder_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||||
dto.setWorkorder_code(newCode);
|
// dto.setWorkorder_code(newCode);
|
||||||
dto.setCreate_id(currentUserId);
|
dto.setCreate_id(currentUserId);
|
||||||
dto.setCreate_time(now);
|
dto.setCreate_time(now);
|
||||||
dto.setCreate_name(nickName);
|
dto.setCreate_name(nickName);
|
||||||
@@ -458,4 +464,83 @@ public class WorkorderServiceImpl implements WorkordeService {
|
|||||||
return resultJSONArray;
|
return resultJSONArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void synchronize(JSONObject param) {
|
||||||
|
// 获取 mes 地址,拼接请求地址
|
||||||
|
String workorder_uri = paramService.findByCode("mes_url").getValue() + "api/mes/workorder";
|
||||||
|
HttpResponse response = HttpRequest
|
||||||
|
.post(workorder_uri)
|
||||||
|
.body(param.toJSONString())
|
||||||
|
.execute();
|
||||||
|
if (response.getStatus() != 200) {
|
||||||
|
throw new BadRequestException("与 MES 通信错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject response_body = JSON.parseObject(response.body());
|
||||||
|
if (ObjectUtil.isEmpty(response_body)) {
|
||||||
|
throw new BadRequestException("MES 响应为空");
|
||||||
|
}
|
||||||
|
if (!response_body.getString("status").equals("200")) {
|
||||||
|
throw new BadRequestException(response_body.getString("message"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析数据添加工单
|
||||||
|
JSONArray data = response_body.getJSONArray("data");
|
||||||
|
WQLObject workorder_table = WQLObject.getWQLObject("pdm_bd_workorder");
|
||||||
|
List<String> workorder_codes = workorder_table
|
||||||
|
.query("is_delete = '0'")
|
||||||
|
.getResultJSONArray(0)
|
||||||
|
.stream()
|
||||||
|
.map(o -> ((JSONObject) o).getString("workorder_code"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
WQLObject material_table = WQLObject.getWQLObject("md_me_materialbase");
|
||||||
|
List<String> material_codes = material_table
|
||||||
|
.query("is_delete = '0'")
|
||||||
|
.getResultJSONArray(0)
|
||||||
|
.stream()
|
||||||
|
.map(o -> ((JSONObject) o).getString("material_code"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
WQLObject device_table = WQLObject.getWQLObject("pdm_bi_device");
|
||||||
|
for (Object o : data) {
|
||||||
|
JSONObject mes_workorder = (JSONObject) o;
|
||||||
|
|
||||||
|
// 判断工单是否存在,已存在则不处理
|
||||||
|
String workorder_code = mes_workorder.getString("workorder_code");
|
||||||
|
if (!workorder_codes.contains(workorder_code)) {
|
||||||
|
// 判断物料是否存在,如果不存在则报错,让用户先去同步物料
|
||||||
|
String material_code = mes_workorder.getString("material_code");
|
||||||
|
if (!material_codes.contains(material_code)) {
|
||||||
|
throw new BadRequestException("工单号[" + workorder_code + "]需要生产的物料不存在,请先同步物料");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理物料id
|
||||||
|
Long material_id = material_table
|
||||||
|
.query("is_delete = '0' AND material_code = '" + material_code + "'")
|
||||||
|
.uniqueResult(0)
|
||||||
|
.getLong("material_id");
|
||||||
|
|
||||||
|
// 处理工单数量
|
||||||
|
int plan_qty = Integer.parseInt(mes_workorder.getString("workorder_qty")) / 1500;
|
||||||
|
|
||||||
|
// 处理设备
|
||||||
|
JSONObject device = device_table
|
||||||
|
.query("is_delete = '0' AND extend_code = '" + mes_workorder.getString("device_code") + "'")
|
||||||
|
.uniqueResult(0);
|
||||||
|
if (ObjectUtil.isEmpty(device)) {
|
||||||
|
throw new BadRequestException("工单号[" + workorder_code + "]的生产设备不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
//添加工单
|
||||||
|
WorkorderDto workorder = new WorkorderDto();
|
||||||
|
workorder.setWorkorder_code(workorder_code);
|
||||||
|
workorder.setMaterial_id(material_id);
|
||||||
|
workorder.setPlan_qty(BigDecimal.valueOf(plan_qty));
|
||||||
|
workorder.setDevice_id(device.getLong("device_id"));
|
||||||
|
workorder.setDevice_code(device.getString("device_code"));
|
||||||
|
workorder.setOrder_status("1");
|
||||||
|
this.create(workorder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
ShiftOrder.produce_date <= 输入.end_time
|
ShiftOrder.produce_date <= 输入.end_time
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.produceorder_code <> ""
|
OPTION 输入.produceorder_code <> ""
|
||||||
ShiftOrder.produceorder_code like 输入.produceorder_code
|
ShiftOrder.workorder_code like 输入.produceorder_code
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.material <> ""
|
OPTION 输入.material <> ""
|
||||||
(
|
(
|
||||||
|
|||||||
@@ -96,4 +96,12 @@ export function getDtl(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export default { add, edit, del, submits, getDevice, getTable, openStart, saveReport, finish, getReportWork, forceFinish, getDtl }
|
export function synchronize(data) {
|
||||||
|
return request({
|
||||||
|
url: 'api/workorder/synchronize',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default { add, edit, del, submits, getDevice, getTable, openStart, saveReport, finish, getReportWork, forceFinish, getDtl, synchronize }
|
||||||
|
|||||||
@@ -218,6 +218,8 @@
|
|||||||
value-format="yyyy-MM-dd"
|
value-format="yyyy-MM-dd"
|
||||||
start-placeholder="开始日期"
|
start-placeholder="开始日期"
|
||||||
end-placeholder="结束日期"
|
end-placeholder="结束日期"
|
||||||
|
:default-value="default_date_show"
|
||||||
|
:picker-options="disabled_time"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -305,6 +307,12 @@ export default {
|
|||||||
permission: {},
|
permission: {},
|
||||||
show_sync_dialog: false,
|
show_sync_dialog: false,
|
||||||
sync_time: '',
|
sync_time: '',
|
||||||
|
default_date_show: '',
|
||||||
|
disabled_time: {
|
||||||
|
disabledDate(time) {
|
||||||
|
return time.getTime() > Date.now() // 可选历史天、可选当前天、不可选未来天
|
||||||
|
}
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
material_id: [
|
material_id: [
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
{ required: true, message: '不能为空', trigger: 'blur' }
|
||||||
@@ -331,6 +339,8 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.default_date_show = new Date()
|
||||||
|
this.default_date_show.setMonth(new Date().getMonth() - 1)
|
||||||
this.initClass1()
|
this.initClass1()
|
||||||
this.initClass2()
|
this.initClass2()
|
||||||
this.initClass3()
|
this.initClass3()
|
||||||
@@ -408,7 +418,6 @@ export default {
|
|||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.show_sync_dialog = false
|
this.show_sync_dialog = false
|
||||||
})
|
})
|
||||||
console.log(this.sync_time)
|
|
||||||
},
|
},
|
||||||
queryClassId() {
|
queryClassId() {
|
||||||
const param = {
|
const param = {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button @click="crud.cancelCU">取消</el-button>
|
||||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="工序名称">
|
<el-form-item v-if="false" label="工序名称">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="query.workorder_procedure"
|
v-model="query.workorder_procedure"
|
||||||
clearable
|
clearable
|
||||||
@@ -65,12 +65,13 @@
|
|||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.workorder_procedure"
|
v-for="item in dict.workorder_procedure"
|
||||||
|
:key="item.detail_id"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="生产日期">
|
<el-form-item v-if="false" label="生产日期">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="query.createTime"
|
v-model="query.createTime"
|
||||||
type="daterange"
|
type="daterange"
|
||||||
@@ -108,6 +109,16 @@
|
|||||||
>
|
>
|
||||||
强制完成
|
强制完成
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
slot="right"
|
||||||
|
class="filter-item"
|
||||||
|
type="success"
|
||||||
|
icon="el-icon-position"
|
||||||
|
size="mini"
|
||||||
|
@click="show_sync_dialog = true"
|
||||||
|
>
|
||||||
|
同步
|
||||||
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
@@ -115,76 +126,109 @@
|
|||||||
:before-close="crud.cancelCU"
|
:before-close="crud.cancelCU"
|
||||||
:visible.sync="crud.status.cu > 0"
|
:visible.sync="crud.status.cu > 0"
|
||||||
:title="crud.status.title"
|
:title="crud.status.title"
|
||||||
width="1200px"
|
width="400px"
|
||||||
>
|
>
|
||||||
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="mini" label-width="160px">
|
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||||||
<el-form-item label="生产日期" prop="produce_date">
|
<el-row>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="工单编号" prop="workorder_code">
|
||||||
|
<el-input v-model="form.workorder_code" :disabled="crud.status.edit" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="物料编码" prop="material_code">
|
||||||
|
<el-input
|
||||||
|
v-model="form.material_code"
|
||||||
|
:disabled="crud.status.edit"
|
||||||
|
style="width: 200px;"
|
||||||
|
clearable
|
||||||
|
@focus="materialShow=true"
|
||||||
|
@clear="form.material_id='',form.material_code='',form.material_name='',form.material_spec=''"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="物料名称" prop="material_name">
|
||||||
|
<el-input
|
||||||
|
v-model="form.material_name"
|
||||||
|
style="width: 200px;"
|
||||||
|
disabled
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="计划数量" prop="plan_qty">
|
||||||
|
<el-input v-model="form.plan_qty" :disabled="crud.status.edit" style="width: 200px;">
|
||||||
|
<span slot="suffix">盅</span>
|
||||||
|
</el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="16">
|
||||||
|
<el-form-item label="生产设备" prop="device_code">
|
||||||
|
<el-input
|
||||||
|
v-model="form.device_code"
|
||||||
|
:disabled="crud.status.edit"
|
||||||
|
style="width: 200px;"
|
||||||
|
clearable
|
||||||
|
@focus="deviceShow=true"
|
||||||
|
@clear="form.device_id='', form.device_code=''"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col>
|
||||||
|
<el-form-item label="工单状态">
|
||||||
|
<el-select
|
||||||
|
v-model="form.order_status"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
size="mini"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 200px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in dict.pdm_workorder_status"
|
||||||
|
:key="item.detail_id"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-form-item v-if="false" label="生产日期" prop="produce_date">
|
||||||
<el-date-picker v-model="form.produce_date" type="date" value-format="yyyy-MM-dd" style="width: 200px;" />
|
<el-date-picker v-model="form.produce_date" type="date" value-format="yyyy-MM-dd" style="width: 200px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="false" label="物料标识" prop="material_id">
|
<el-form-item v-if="false" label="物料标识" prop="material_id">
|
||||||
<el-input v-model="form.material_id" style="width: 200px;" />
|
<el-input v-model="form.material_id" style="width: 200px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="生产设备">
|
<!-- <el-form-item label="物料规格" prop="material_spec">-->
|
||||||
<el-input
|
<!-- <el-input-->
|
||||||
v-model="form.device_code"
|
<!-- v-model="form.material_spec"-->
|
||||||
style="width: 200px;"
|
<!-- style="width: 200px;"-->
|
||||||
clearable
|
<!-- disabled-->
|
||||||
@focus="deviceShow=true"
|
<!-- />-->
|
||||||
@clear="form.device_id='', form.device_code=''"
|
<!-- </el-form-item>-->
|
||||||
/>
|
<el-form-item v-if="false" label="载具类型" prop="vehicle_type">
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="物料编码" prop="material_code">
|
|
||||||
<el-input
|
|
||||||
v-model="form.material_code"
|
|
||||||
style="width: 200px;"
|
|
||||||
clearable
|
|
||||||
@focus="materialShow=true"
|
|
||||||
@clear="form.material_id='',form.material_code='',form.material_name='',form.material_spec=''"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="物料名称" prop="material_name">
|
|
||||||
<el-input
|
|
||||||
v-model="form.material_name"
|
|
||||||
style="width: 200px;"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<!-- <el-form-item label="物料规格" prop="material_spec">-->
|
|
||||||
<!-- <el-input-->
|
|
||||||
<!-- v-model="form.material_spec"-->
|
|
||||||
<!-- style="width: 200px;"-->
|
|
||||||
<!-- disabled-->
|
|
||||||
<!-- />-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<el-form-item label="计划数量" prop="plan_qty">
|
|
||||||
<el-input v-model="form.plan_qty" style="width: 200px;" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="载具类型" prop="vehicle_type">
|
|
||||||
<el-select v-model="form.vehicle_type" style="width: 200px" filterable placeholder="请选择">
|
<el-select v-model="form.vehicle_type" style="width: 200px" filterable placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.vehicle_type"
|
v-for="item in dict.vehicle_type"
|
||||||
|
:key="item.detail_id"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="工单状态">
|
<el-form-item v-if="false" label="所属工序" prop="workorder_procedure">
|
||||||
<el-select
|
|
||||||
v-model="form.order_status"
|
|
||||||
clearable
|
|
||||||
filterable
|
|
||||||
size="mini"
|
|
||||||
class="filter-item"
|
|
||||||
style="width: 200px"
|
|
||||||
>
|
|
||||||
<el-option
|
|
||||||
v-for="item in dict.pdm_workorder_status"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value"
|
|
||||||
/>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="所属工序" prop="workorder_procedure">
|
|
||||||
<el-select
|
<el-select
|
||||||
v-model="form.workorder_procedure"
|
v-model="form.workorder_procedure"
|
||||||
clearable
|
clearable
|
||||||
@@ -195,12 +239,13 @@
|
|||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.workorder_procedure"
|
v-for="item in dict.workorder_procedure"
|
||||||
|
:key="item.detail_id"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="计划开始时间" prop="planproducestart_date">
|
<el-form-item v-if="false" label="计划开始时间" prop="planproducestart_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.planproducestart_date"
|
v-model="form.planproducestart_date"
|
||||||
value-format="yyyy-MM-dd HH:mm:ss"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
@@ -208,7 +253,7 @@
|
|||||||
style="width: 200px;"
|
style="width: 200px;"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="计划结束时间" prop="planproduceend_date">
|
<el-form-item v-if="false" label="计划结束时间" prop="planproduceend_date">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="form.planproduceend_date"
|
v-model="form.planproduceend_date"
|
||||||
value-format="yyyy-MM-dd HH:mm:ss"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
||||||
@@ -216,7 +261,7 @@
|
|||||||
style="width: 200px;"
|
style="width: 200px;"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="是否搬运" prop="is_needmove">
|
<el-form-item v-if="false" label="是否搬运" prop="is_needmove">
|
||||||
<el-radio
|
<el-radio
|
||||||
v-for="item in dict.is_or_not"
|
v-for="item in dict.is_or_not"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@@ -248,37 +293,37 @@
|
|||||||
<!-- <el-link type="warning" @click="toView(scope.row)">{{ scope.row.produceorder_code }}</el-link>-->
|
<!-- <el-link type="warning" @click="toView(scope.row)">{{ scope.row.produceorder_code }}</el-link>-->
|
||||||
<!-- </template>-->
|
<!-- </template>-->
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column prop="material_code" label="物料编码" width="100" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="material_name" label="物料名称" width="100" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="plan_qty" label="计划数量" />
|
||||||
|
<el-table-column prop="device_name" label="生产设备" width="100" show-overflow-tooltip />
|
||||||
<el-table-column prop="order_status" label="工单状态">
|
<el-table-column prop="order_status" label="工单状态">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ dict.label.pdm_workorder_status[scope.row.order_status] }}
|
{{ dict.label.pdm_workorder_status[scope.row.order_status] }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="produce_date" label="生产日期" width="100px" />
|
<el-table-column v-if="false" prop="produce_date" label="生产日期" width="100px" />
|
||||||
<el-table-column prop="plan_qty" label="计划数量" />
|
<el-table-column v-if="false" prop="real_qty" label="实际数量" />
|
||||||
<el-table-column prop="real_qty" label="实际数量" />
|
|
||||||
<el-table-column v-if="false" prop="material_id" label="物料标识" />
|
<el-table-column v-if="false" prop="material_id" label="物料标识" />
|
||||||
<el-table-column prop="device_name" label="设备" width="100" show-overflow-tooltip />
|
<!-- <el-table-column prop="material_spec" label="物料规格" width="100" show-overflow-tooltip />-->
|
||||||
<el-table-column prop="material_code" label="物料编码" width="100" show-overflow-tooltip />
|
<el-table-column v-if="false" prop="planproducestart_date" label="计划开始时间" min-width="150" show-overflow-tooltip />
|
||||||
<el-table-column prop="material_name" label="物料名称" width="100" show-overflow-tooltip />
|
<el-table-column v-if="false" prop="planproduceend_date" label="计划结束时间" min-width="150" show-overflow-tooltip />
|
||||||
<!-- <el-table-column prop="material_spec" label="物料规格" width="100" show-overflow-tooltip />-->
|
<el-table-column v-if="false" prop="realproducestart_date" label="实际开始时间" min-width="150" show-overflow-tooltip />
|
||||||
<el-table-column prop="planproducestart_date" label="计划开始时间" min-width="150" show-overflow-tooltip />
|
<el-table-column v-if="false" prop="realproduceend_date" label="实际结束时间" min-width="150" show-overflow-tooltip />
|
||||||
<el-table-column prop="planproduceend_date" label="计划结束时间" min-width="150" show-overflow-tooltip />
|
<el-table-column v-if="false" prop="vehicle_type" label="载具类型" min-width="120" show-overflow-tooltip>
|
||||||
<el-table-column prop="realproducestart_date" label="实际开始时间" min-width="150" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="realproduceend_date" label="实际结束时间" min-width="150" show-overflow-tooltip />
|
|
||||||
<el-table-column prop="vehicle_type" label="载具类型" min-width="120" show-overflow-tooltip>
|
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
|
{{ dict.label.vehicle_type[scope.row.vehicle_type] }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="is_needmove" label="是否搬运">
|
<el-table-column v-if="false" prop="is_needmove" label="是否搬运">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
{{ dict.label.is_or_not[scope.row.is_needmove] }}
|
{{ dict.label.is_or_not[scope.row.is_needmove] }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="create_name" label="创建人" />
|
<el-table-column prop="create_name" label="创建人" />
|
||||||
<el-table-column prop="create_time" label="创建时间" width="150" />
|
<el-table-column prop="create_time" label="创建时间" width="150" />
|
||||||
<el-table-column prop="update_optname" label="修改人" />
|
<el-table-column v-if="false" prop="update_optname" label="修改人" />
|
||||||
<el-table-column prop="update_time" label="修改时间" width="150" />
|
<el-table-column v-if="false" prop="update_time" label="修改时间" width="150" />
|
||||||
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation
|
||||||
@@ -288,6 +333,35 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
<!--同步对话框-->
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="show_sync_dialog"
|
||||||
|
width="400px"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
:inline="true"
|
||||||
|
class="demo-form-inline"
|
||||||
|
label-position="right"
|
||||||
|
label-width="80px"
|
||||||
|
label-suffix=":"
|
||||||
|
>
|
||||||
|
<el-form-item label="同步时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="sync_time"
|
||||||
|
type="daterange"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-value="default_date_show"
|
||||||
|
:picker-options="disabled_time"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="show_sync_dialog = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="synchronize()">确 定</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
<!--分页组件-->
|
<!--分页组件-->
|
||||||
<pagination />
|
<pagination />
|
||||||
</div>
|
</div>
|
||||||
@@ -343,7 +417,8 @@ const defaultForm = {
|
|||||||
is_canupdate_update: '1',
|
is_canupdate_update: '1',
|
||||||
material_spec: null,
|
material_spec: null,
|
||||||
sale_id: null,
|
sale_id: null,
|
||||||
workorder_procedure: ''
|
workorder_procedure: '',
|
||||||
|
workorder_code: null
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
name: 'Produceshiftorder',
|
name: 'Produceshiftorder',
|
||||||
@@ -375,47 +450,66 @@ export default {
|
|||||||
workprocedureList: [],
|
workprocedureList: [],
|
||||||
order_status: ['-1'],
|
order_status: ['-1'],
|
||||||
permission: {},
|
permission: {},
|
||||||
|
show_sync_dialog: false,
|
||||||
|
sync_time: '',
|
||||||
|
default_date_show: '',
|
||||||
|
disabled_time: {
|
||||||
|
disabledDate(time) {
|
||||||
|
return time.getTime() > Date.now() // 可选历史天、可选当前天、不可选未来天
|
||||||
|
}
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
produceorder_code: [
|
// produceorder_code: [
|
||||||
{ required: true, message: '生产班次工单编号不能为空', trigger: 'blur' }
|
// { required: true, message: '生产班次工单编号不能为空', trigger: 'blur' }
|
||||||
],
|
// ],
|
||||||
producedeviceorder_code: [
|
// producedeviceorder_code: [
|
||||||
{ required: true, message: '机台工单号不能为空', trigger: 'blur' }
|
// { required: true, message: '机台工单号不能为空', trigger: 'blur' }
|
||||||
],
|
// ],
|
||||||
produce_date: [
|
// produce_date: [
|
||||||
{ required: true, message: '生产日期不能为空', trigger: 'blur' }
|
// { required: true, message: '生产日期不能为空', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
|
workorder_code: [
|
||||||
|
{ required: true, message: '工单编号不能为空', trigger: 'change' }
|
||||||
],
|
],
|
||||||
plan_qty: [
|
plan_qty: [
|
||||||
{ required: true, message: '计划数量不能为空', trigger: 'blur' }
|
{ required: true, message: '计划数量不能为空', trigger: 'change' }
|
||||||
],
|
],
|
||||||
material_code: [
|
material_code: [
|
||||||
{ required: true, message: '物料编码不能为空', trigger: 'change' }
|
{ required: true, message: '物料编码不能为空', trigger: 'change' }
|
||||||
],
|
],
|
||||||
planproducestart_date: [
|
material_name: [
|
||||||
{ required: true, message: '计划生产开始时间不能为空', trigger: 'blur' }
|
{ required: true, message: '物料名称不能为空', trigger: 'change' }
|
||||||
],
|
|
||||||
planproduceend_date: [
|
|
||||||
{ required: true, message: '计划生产结束时间不能为空', trigger: 'blur' }
|
|
||||||
],
|
],
|
||||||
|
// planproducestart_date: [
|
||||||
|
// { required: true, message: '计划生产开始时间不能为空', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
|
// planproduceend_date: [
|
||||||
|
// { required: true, message: '计划生产结束时间不能为空', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
order_status: [
|
order_status: [
|
||||||
{ required: true, message: '工单状态不能为空', trigger: 'blur' }
|
{ required: true, message: '工单状态不能为空', trigger: 'change' }
|
||||||
],
|
],
|
||||||
is_needmove: [
|
device_code: [
|
||||||
{ required: true, message: '是否搬运不能为空', trigger: 'blur' }
|
{ required: true, message: '生产设备不能为空', trigger: 'change' }
|
||||||
],
|
|
||||||
order_type_scode: [
|
|
||||||
{ required: true, message: '工单类型不能为空', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
is_canupdate_update: [
|
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
workorder_procedure: [
|
|
||||||
{ required: true, message: '所属工序不能为空', trigger: 'blur' }
|
|
||||||
]
|
]
|
||||||
|
// is_needmove: [
|
||||||
|
// { required: true, message: '是否搬运不能为空', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
|
// order_type_scode: [
|
||||||
|
// { required: true, message: '工单类型不能为空', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
|
// is_canupdate_update: [
|
||||||
|
// { required: true, message: '不能为空', trigger: 'blur' }
|
||||||
|
// ],
|
||||||
|
// workorder_procedure: [
|
||||||
|
// { required: true, message: '所属工序不能为空', trigger: 'blur' }
|
||||||
|
// ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.default_date_show = new Date()
|
||||||
|
this.default_date_show.setMonth(new Date().getMonth() - 1)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 工单状态多选搜索
|
// 工单状态多选搜索
|
||||||
@@ -470,6 +564,15 @@ export default {
|
|||||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
this.crud.toQuery()
|
this.crud.toQuery()
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
synchronize() {
|
||||||
|
crudWorkorder.synchronize({ start_time: this.sync_time[0], end_time: this.sync_time[1] }).then(res => {
|
||||||
|
this.show_sync_dialog = false
|
||||||
|
this.sync_time = ''
|
||||||
|
this.crud.notify('同步成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||||
|
}).catch(() => {
|
||||||
|
this.show_sync_dialog = false
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user