This commit is contained in:
zds
2022-11-20 21:40:59 +08:00
parent 1918282cf5
commit 1cc0f75c6f
19 changed files with 594 additions and 80 deletions

View File

@@ -88,4 +88,7 @@ public class ProductplanprocDto implements Serializable {
/** 任务号 */
private String task_code;
/** 导入人 */
private Long device_id;
}

View File

@@ -94,6 +94,13 @@ public class ProducetaskController {
producetaskprocService.submit2(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("提交")
@ApiOperation("提交")
@PostMapping("/submit3")
public ResponseEntity<Object> submit3(@RequestBody JSONObject whereJson) {
producetaskprocService.submit3(whereJson);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导入月计划excel")
@ApiOperation("导入月计划excel")
@PostMapping({"/importExcel/{bomtype}"})

View File

@@ -82,6 +82,11 @@ public interface ProducetaskprocService {
* @param whereJson /
*/
void submit2(JSONObject whereJson);
/**
* 提交
* @param whereJson /
*/
void submit3(JSONObject whereJson);
/**
* 提交

View File

@@ -272,8 +272,17 @@ public class DailyplanServiceImpl implements DailyplanService {
Date date = DateUtil.parse(planstart_date);
int days = this.getDays(json.getString("material_id"));
Date planend_date = DateUtil.offsetDay(date,days-1);
json.put("planend_date",DateUtil.formatDate(planend_date));
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planend_time)
.addParam("device_id", json.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+planend_time+"后的工作日历!");
}
json.put("planend_date",last_day.getString("factory_date"));
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+json.getString("material_id")+"'").uniqueResult(0);
double standard_weight = mater.getDouble("standard_weight_pft");
@@ -314,7 +323,17 @@ public class DailyplanServiceImpl implements DailyplanService {
Date date = DateUtil.parse(planstart_date);
int days = this.getDays(whereJson.getString("material_id"));
Date planend_date = DateUtil.offsetDay(date,days-1);
whereJson.put("planend_date",DateUtil.formatDate(planend_date));
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planend_time)
.addParam("device_id", whereJson.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+planend_time+"后的工作日历!");
}
whereJson.put("planend_date",last_day.getString("factory_date"));
JSONObject mater = MD_ME_ProducMaterialExt.query("material_id='"+whereJson.getString("material_id")+"'").uniqueResult(0);
double standard_weight = mater.getDouble("standard_weight_pft");
@@ -609,6 +628,7 @@ public class DailyplanServiceImpl implements DailyplanService {
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planstart_date)
.addParam("device_id", jo.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
@@ -618,7 +638,18 @@ public class DailyplanServiceImpl implements DailyplanService {
int days = this.getDays(jo.getString("material_id"));
Date start_date = DateUtil.parse(planstart_date);
Date planend_date = DateUtil.offsetDay(start_date,days-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
String str_planend_date = DateUtil.formatDate(planend_date);
JSONObject last_planend_date = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", str_planend_date.substring(0,10))
.addParam("device_id", jo.getString("device_id"))
.process()
.uniqueResult(0);
if(last_planend_date == null){
throw new BadRequestException("未配置"+str_planend_date.substring(0,10)+"后的工作日历!");
}
jo.put("planend_date", last_planend_date.getString("factory_date"));
JSONArray lasts = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "8")
.addParam("device_id", jo.getString("device_id"))
@@ -684,7 +715,16 @@ public class DailyplanServiceImpl implements DailyplanService {
new_jo.put("product_series_id", json.getString("product_series_id"));
new_jo.put("device_id", json.getString("device_id"));
new_jo.put("planstart_date", json.getString("planstart_date"));
new_jo.put("planend_date", json.getString("planend_date"));
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", json.getString("planend_date"))
.addParam("device_id", json.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+json.getString("planend_date")+"后的工作日历!");
}
new_jo.put("planend_date", last_day.getString("factory_date"));
new_jo.put("remark", json.getString("remark"));

View File

@@ -44,7 +44,7 @@ public class FactoryCalendarServiceImpl implements FactoryCalendarService {
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String search = MapUtil.getStr(whereJson, "search");
HashMap<String, String> map = new HashMap<>();
HashMap<String, String> map = new HashMap<>(whereJson);
map.put("flag", "1");
if (StrUtil.isNotEmpty(search)) map.put("search", "%" + search + "%");
@@ -171,9 +171,9 @@ public class FactoryCalendarServiceImpl implements FactoryCalendarService {
String is_active = whereJson.getString("is_active");
if (is_active.equals("1")) {
//查询是否存在已经启用的日历
JSONObject mst = WQLObject.getWQLObject("PDM_BI_FactoryCalendar").query("is_active = '1' AND is_delete = '0'").uniqueResult(0);
JSONObject mst = WQLObject.getWQLObject("PDM_BI_FactoryCalendar").query("is_active = '1' AND is_delete = '0' and device_id='"+whereJson.getString("device_id")+"'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(mst)) {
throw new PdaRequestException("工厂日历只能启用一个!");
throw new PdaRequestException("同一个设备工厂日历只能启用一个!");
}
}
WQLObject.getWQLObject("PDM_BI_FactoryCalendar").update(whereJson);

View File

@@ -185,7 +185,17 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
procTab.delete(jsonProc);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void submit3(JSONObject json) {
WQLObject procTab = WQLObject.getWQLObject("pcs_if_productplanproc");
JSONObject jsonProc = procTab.query("plan_id = '" + json.getString("plan_id") + "'").uniqueResult(0);
if(StrUtil.equals(jsonProc.getString("is_proc"), "2")){
throw new BadRequestException("排产状态,不可修改");
}
jsonProc.put("device_id",json.getString("device_id"));
procTab.update(jsonProc);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void submit(JSONObject json) {
@@ -217,6 +227,8 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
WQLObject planProcTab = WQLObject.getWQLObject("pcs_if_productplanproc");
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
WQLObject em_bi_deviceinfo = WQLObject.getWQLObject("em_bi_deviceinfo");
WQLObject MD_ME_ProducMaterialExt = WQLObject.getWQLObject("MD_ME_ProducMaterialExt");
JSONObject json = WQL.getWO("QPCS_IF_PRODUCTPLANPROC02").addParam("flag", "1").addParam("id", id).process().uniqueResult(0);
//根据路径获取表格里的记录
String path = json.getString("path");
@@ -230,7 +242,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
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));
String device_code = 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));
@@ -255,7 +267,6 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
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"));
@@ -276,6 +287,24 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
dto.setUpdate_optname(SecurityUtils.getNickName());
dto.setUpdate_time(DateUtil.now());
dto.setRemark(remark);
if(StrUtil.isNotEmpty(device_code) && !"null".equals(device_code)){
JSONObject device = em_bi_deviceinfo.query("is_delete='0' and is_active='1' and device_code='"+device_code+"'").uniqueResult(0);
if(device!=null){
dto.setDevice_id(device.getLong("device_id"));
}
}else{
JSONObject jsonMater2 = MD_ME_ProducMaterialExt.query("material_id = '" + jsonMater.getString("material_id") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater2)) {
throw new BadRequestException("此【" + material_code + "】物料未配置成品物料扩展信息");
}
String product_series = jsonMater2.getString("product_series");
if(StrUtil.isNotEmpty(product_series)){
JSONObject device = WQL.getWO("QPDM_PRODUCTPLANPROC").addParam("flag", "33").addParam("product_series", product_series).process().uniqueResult(0);
if(device!=null){
dto.setDevice_id(device.getLong("id"));
}
}
}
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 + "' and plan_finish_date='"+plan_finish_date+"'").uniqueResult(0);
@@ -786,6 +815,7 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planstart_date)
.addParam("device_id", jo.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
@@ -795,7 +825,18 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
int days = this.getDays(jo.getString("material_id"));
Date start_date = DateUtil.parse(planstart_date);
Date planend_date = DateUtil.offsetDay(start_date,days-1);
jo.put("planend_date",DateUtil.formatDate(planend_date));
String str_planend_date = DateUtil.formatDate(planend_date);
JSONObject last_planend_date = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", str_planend_date.substring(0,10))
.addParam("device_id", jo.getString("device_id"))
.process()
.uniqueResult(0);
if(last_planend_date == null){
throw new BadRequestException("未配置"+str_planend_date.substring(0,10)+"后的工作日历!");
}
jo.put("planend_date", last_planend_date.getString("factory_date"));
JSONArray lasts = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "8")
.addParam("device_id", jo.getString("device_id"))
@@ -900,7 +941,17 @@ public class ProducetaskprocServiceImpl implements ProducetaskprocService {
new_jo.put("product_series_id", json.getString("product_series_id"));
new_jo.put("device_id", json.getString("device_id"));
new_jo.put("planstart_date", json.getString("planstart_date"));
new_jo.put("planend_date", json.getString("planend_date"));
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", json.getString("planend_date"))
.addParam("device_id", json.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+json.getString("planend_date")+"后的工作日历!");
}
new_jo.put("planend_date", last_day.getString("factory_date"));
new_jo.put("remark", json.getString("remark"));

View File

@@ -132,7 +132,16 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
int days = this.getDays(json.getString("material_id"));
Date planend_date = DateUtil.offsetDay(date,days-1);
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
json.put("planend_time",planend_time+" 23:59:59");
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planend_time)
.addParam("device_id", json.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+planend_time+"后的工作日历!");
}
json.put("planend_time",last_day.getString("factory_date")+" 23:59:59");
mstTab.insert(json);
this.updatePcsn(json);
}
@@ -178,7 +187,16 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
int days = this.getDays(whereJson.getString("material_id"));
Date planend_date = DateUtil.offsetDay(date,days-1);
String planend_time = DateUtil.formatDate(planend_date).substring(0,10);
whereJson.put("planend_time",planend_time+" 23:59:59");
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planend_time)
.addParam("device_id", whereJson.getString("device_id"))
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+planend_time+"后的工作日历!");
}
whereJson.put("planend_time",last_day.getString("factory_date")+" 23:59:59");
mstTab.update(whereJson);
}
@@ -275,11 +293,7 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
WQLObject em_bi_deviceinfo = WQLObject.getWQLObject("em_bi_deviceinfo");
WQLObject wo_param = WQLObject.getWQLObject("sys_param");
JSONArray ja = json.getJSONArray("rows");
JSONArray calendar = pdm_bi_factorycalendar.query("is_active='1' and is_delete = '0'").getResultJSONArray(0);
if(calendar.size()!=1){
throw new BadRequestException("未设置满足条件的的日历!");
}
String factorycalendar_id = calendar.getJSONObject(0).getString("factorycalendar_id");
for (int i = 0; i < ja.size(); i++) {
JSONObject jo = ja.getJSONObject(i);
@@ -288,6 +302,12 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
throw new BadRequestException(jo.getString("workorder_code") + "当前工令记录状态异常,操作失败!");
}
String jo_device_id = jsonMst.getString("device_id");
JSONObject calendar = pdm_bi_factorycalendar.query("is_active='1' and is_delete = '0' and device_id='"+jo_device_id+"'").uniqueResult(0);
if(calendar == null){
throw new BadRequestException("当前设备未设置满足条件的的日历!");
}
String factorycalendar_id = calendar.getString("factorycalendar_id");
JSONObject Formula = PDM_BI_Formula.query("workorder_id ='" + jo.getString("workorder_id") + "' and is_delete = '0' and is_audit='0' ").uniqueResult(0);
if (Formula != null) {
throw new BadRequestException(jo.getString("workorder_code") + "工令对应配方未审核,操作失败!");
@@ -462,14 +482,38 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
//是否有工序任务
if(late_task==null){//没有
if(devices.size()>0){
device_id = devices.getJSONObject(0).getString("device_id");
JSONObject device = em_bi_deviceinfo.query("device_id='"+device_id+"'").uniqueResult(0);
if(device!=null){
planstart_time = planstart_date+" "+device.getString("honor_time");
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planstart_date)
.addParam("device_id", device_id)
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+planstart_date+"后的工作日历!");
}
planstart_time = last_day.getString("factory_date")+" "+device.getString("honor_time");
}
}
}else{//有
planstart_time = late_task.getString("planend_time");
planstart_date = planstart_time.substring(0,10);
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", planstart_date)
.addParam("device_id", device_id)
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+planstart_date+"后的工作日历!");
}
if(!planstart_date.equals(last_day.getString("factory_date"))){
JSONObject device = em_bi_deviceinfo.query("device_id='"+device_id+"'").uniqueResult(0);
if(device!=null){
planstart_time = last_day.getString("factory_date")+" "+device.getString("honor_time");
}
}
}
}
}else if("GX008".equals(workprocedure_code)) {//压团制粒工序
@@ -506,7 +550,6 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
}
}
Date date = DateUtil.parse(planstart_time);
// DateTime newDate1 = DateUtil.offsetHour(date, routedtl.getInteger("plan_time"));
jsonMst.put("planstart_time", date.toString());
routedtl.put("planstart_time", date.toString());
@@ -514,6 +557,20 @@ public class WorkOrderServiceImpl implements WorkOrdereService {
DateTime newDate2 = DateUtil.offsetHour(date, routedtl.getInteger("product_time"));
jsonMst.put("planend_time", newDate2.toString());
routedtl.put("planend_time",newDate2.toString());
if("GX003".equals(workprocedure_code)) {//喷雾工序
JSONObject last_day = WQL.getWO("QPDM_PRODUCTPLANPROC")
.addParam("flag", "7")
.addParam("planstart_date", newDate2.toString().substring(0, 10))
.addParam("device_id", device_id)
.process()
.uniqueResult(0);
if(last_day ==null){
throw new BadRequestException("未配置"+newDate2.toString().substring(0, 10)+"后的工作日历!");
}
newDate2 = DateUtil.parse(last_day.getString("factory_date")+" "+newDate2.toString().substring(11));
jsonMst.put("planend_time", newDate2.toString());
routedtl.put("planend_time",newDate2.toString());
}
routeBefore = routedtl;
if ((j + 1) < routeDtls.size()) {//非最后一道工序
JSONObject routeNext = routeDtls.getJSONObject(j + 1);

View File

@@ -16,6 +16,7 @@
输入.flag TYPEAS s_string
输入.search TYPEAS s_string
输入.processroute_code TYPEAS s_string
输入.device_id TYPEAS s_string
[临时表]
@@ -44,6 +45,7 @@
PAGEQUERY
SELECT
dar.*,
device.device_name,
dept.NAME,
(
case when dar.is_active = '0' then '否'
@@ -51,11 +53,15 @@
FROM
pdm_bi_factorycalendar dar
LEFT JOIN sys_dept dept ON dar.org_id = dept.dept_id
LEFT JOIN em_bi_deviceinfo device ON device.device_id = dar.device_id
WHERE
dar.is_delete = '0'
OPTION 输入.search <> ""
(dar.factorycalendar_code like 输入.search or
dar.factorycalendar_name like 输入.search)
ENDOPTION
OPTION 输入.device_id <> ""
device.device_id = 输入.device_id
ENDOPTION
ENDSELECT
ENDPAGEQUERY

View File

@@ -56,10 +56,12 @@
pp.*,
ext.old_mark,
ext.standard_mark,
ext.standard_weight_pft AS standard_weight
ext.standard_weight_pft AS standard_weight,
deviceinfo.device_name
FROM
PCS_IF_ProductPlanProc pp
LEFT JOIN MD_ME_ProducMaterialExt ext ON pp.material_id = ext.material_id
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = pp.device_id
WHERE
1=1
OPTION 输入.is_proc <> ""
@@ -80,6 +82,9 @@
OPTION 输入.plan_org_code <> ""
pp.plan_org_code = 输入.plan_org_code
ENDOPTION
OPTION 输入.device_id <> ""
pp.device_id = 输入.device_id
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
@@ -93,30 +98,12 @@
ext.standard_weight_pft AS standard_weight,
materialbase.material_type_id,
ext.product_series,
deviceinfo.device_id,
deviceinfo.device_name
FROM
PCS_IF_ProductPlanProc pp
LEFT JOIN md_me_materialbase materialbase ON pp.material_id = materialbase.material_id
LEFT JOIN MD_ME_ProducMaterialExt ext ON pp.material_id = ext.material_id
INNER JOIN (
SELECT
WorkDevice.workprocedure_id,
WorkDevice.product_series_id,
WorkDevice.captemplate_id,
MAX( WorkDevice.device_id ) AS device_id
FROM
MPS_BD_CapacityTemplateWorkDevice WorkDevice
WHERE
1 = 1
AND WorkDevice.captemplate_id = '1534741977764073472'
AND WorkDevice.workprocedure_id = '1472449923327856640'
GROUP BY
WorkDevice.workprocedure_id,
WorkDevice.product_series_id,
WorkDevice.captemplate_id
) WorkDevice2 ON concat( ext.product_series ) = concat( WorkDevice2.product_series_id )
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = WorkDevice2.device_id
LEFT JOIN em_bi_deviceinfo deviceinfo ON deviceinfo.device_id = pp.device_id
WHERE
1 = 1
AND pp.is_proc IN ( '1', '2' )
@@ -124,7 +111,7 @@
pp.is_proc = 输入.is_proc
ENDOPTION
OPTION 输入.device_id <> ""
deviceinfo.device_id = 输入.device_id
pp.device_id = 输入.device_id
ENDOPTION
OPTION 输入.plan_month <> ""
pp.plan_month = 输入.plan_month
@@ -185,6 +172,7 @@
OPTION 输入.product_series <> ""
WorkDevice.product_series_id = 输入.product_series
ENDOPTION
order by deviceinfo.device_code asc
ENDSELECT
ENDQUERY
ENDIF
@@ -260,6 +248,9 @@
OPTION 输入.planstart_date <> ""
FactoryCalendarDtl.factory_date >= 输入.planstart_date
ENDOPTION
OPTION 输入.device_id <> ""
FactoryCalendar.device_id = 输入.device_id
ENDOPTION
ORDER BY FactoryCalendarDtl.factory_date
ENDSELECT
ENDQUERY

View File

@@ -31,6 +31,14 @@ export function importExcel(id) {
})
}
export function submit3(data) {
return request({
url: 'api/producetask/submit3',
method: 'post',
data
})
}
export function submit(data) {
return request({
url: 'api/producetask/submit',
@@ -62,4 +70,4 @@ export function getCapacitytes(params) {
params
})
}
export default { add, edit, del, importExcel, getCapacitytes, submit, getDevices, submit2 }
export default { add, edit, del, importExcel, getCapacitytes, submit, getDevices, submit2, submit3 }

View File

@@ -27,7 +27,7 @@
</el-form-item>
<el-form-item label="模板名称" prop="captemplate_name">
<label slot="label">模板名称:</label>
<el-input v-model="form.captemplate_name" clearable style="width: 210px" />
<el-input v-model="form.captemplate_name" clearable style="width: 210px" />
</el-form-item>
<el-form-item label="明细数" prop="detail_count">
<label slot="label">明&nbsp;&nbsp;细&nbsp;数:</label>
@@ -51,9 +51,9 @@
@current-change="handleDtlCurrentChange"
>
<el-table-column label="模板系列">
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="product_series" label="产品系列" min-width="150px" align="center"/>
<el-table-column prop="totalproducecapacity_qty" :formatter="crud.formatNum3" label="产能" min-width="150px" align="center"/>
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="product_series" label="产品系列" min-width="150px" align="center" />
<el-table-column prop="totalproducecapacity_qty" :formatter="crud.formatNum3" label="产能" min-width="150px" align="center" />
</el-table-column>
</el-table>
</el-col>
@@ -68,17 +68,17 @@
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
>
<el-table-column label="模板系列工序详情">
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="product_series" label="系列" min-width="150px" align="center"/>
<el-table-column prop="workprocedure_name" label="工序" min-width="150px" align="center" />
<el-table-column prop="resource_qty" label="资源数" min-width="150px" align="center" >
<el-table-column type="index" label="序号" width="50" align="center" />
<el-table-column prop="product_series" label="系列" min-width="150px" align="center" />
<el-table-column prop="workprocedure_name" label="工序" min-width="150px" align="center" />
<el-table-column prop="resource_qty" label="资源数" min-width="150px" align="center">
<template scope="scope">
<el-input v-model="scope.row.resource_qty" disabled class="input-with-select">
<el-button slot="append" icon="el-icon-plus" @click="queryDevice(scope.$index, scope.row)" />
</el-input>
</template>
</el-table-column>
<el-table-column prop="producecapacity_qty" :formatter="crud.formatNum3" label="产能" min-width="150px" align="center"/>
<el-table-column prop="producecapacity_qty" :formatter="crud.formatNum3" label="产能" min-width="150px" align="center" />
</el-table-column>
</el-table>
</el-col>
@@ -160,33 +160,40 @@ export default {
handleDtlCurrentChange(current) {
if (current !== null) {
this.nowrow2 = current
if(this.nowrow2.tableData1 != null && this.nowrow2.tableData1.length>0){
if (this.nowrow2.tableData1 != null && this.nowrow2.tableData1.length > 0) {
this.tableData1 = this.nowrow2.tableData1
}else{
if(this.nowrow2.totalproducecapacity_qty > 0 ){
capacitytemplate.getWorklist({ 'captemplate_id': this.form.captemplate_id ,'product_series_id':current.product_series_id }).then(res => {
} else {
if (this.nowrow2.totalproducecapacity_qty > 0) {
capacitytemplate.getWorklist({ 'captemplate_id': this.form.captemplate_id, 'product_series_id': current.product_series_id }).then(res => {
this.tableData1 = res
}).catch(() => {
this.tableData1 = []
this.tableData1 = []
})
}else{
capacitytemplate.getWorklist({ 'product_series_id':current.product_series_id }).then(res => {
} else {
capacitytemplate.getWorklist({ 'product_series_id': current.product_series_id }).then(res => {
this.tableData1 = res
}).catch(() => {
this.tableData1 = []
this.tableData1 = []
})
}
}
}
},
tableChanged(rows) {
if(rows.length>0){
let sum = 0.0;
let devices = ',';
let flag1 = true
if (rows.length > 0) {
let sum = 0.0
let devices = ','
for (let i = 0; i < rows.length; i++) {
sum = sum + parseFloat(rows[i].device_capacity_qty)
devices = devices + rows[i].device_id + ','
if (rows[i].device_code.includes('PWT')) {
if (flag1) {
sum = sum + parseFloat(rows[i].device_capacity_qty)
flag1 = false
}
} else {
sum = sum + parseFloat(rows[i].device_capacity_qty)
}
}
this.nowrow.resource_qty = rows.length
this.nowrow.producecapacity_qty = sum
@@ -194,16 +201,16 @@ export default {
this.nowrow.tableDevices = rows
this.tableData1.splice(this.nowindex, 1, this.nowrow) // 通过splice 替换数据 触发视图更新
let totalproducecapacity_qty = parseFloat(this.tableData1[0].producecapacity_qty);
for(let i = 0; i < this.tableData1.length; i++){
if(parseFloat(this.tableData1[i].producecapacity_qty) < totalproducecapacity_qty){
let totalproducecapacity_qty = parseFloat(this.tableData1[0].producecapacity_qty)
for (let i = 0; i < this.tableData1.length; i++) {
if (parseFloat(this.tableData1[i].producecapacity_qty) < totalproducecapacity_qty) {
totalproducecapacity_qty = this.tableData1[i].producecapacity_qty
}
}
this.nowrow2.totalproducecapacity_qty = totalproducecapacity_qty
this.nowrow2.tableData1 = this.tableData1
for(let i = 0; i < this.form.tableData.length; i++){
if(this.form.tableData[i].product_series_id === this.nowrow2.product_series_id){
for (let i = 0; i < this.form.tableData.length; i++) {
if (this.form.tableData[i].product_series_id === this.nowrow2.product_series_id) {
this.form.tableData.splice(i, 1, this.nowrow2) // 通过splice 替换数据 触发视图更新
}
}
@@ -211,9 +218,9 @@ export default {
},
[CRUD.HOOK.beforeSubmit]() {
for (let i = 0; i < this.form.tableData.length; i++) {
if(this.form.tableData[i].tableData1 != null && this.form.tableData[i].tableData1.length>0){
if (this.form.tableData[i].tableData1 != null && this.form.tableData[i].tableData1.length > 0) {
if (parseFloat(this.form.tableData[i].totalproducecapacity_qty) <= 0) {
this.crud.notify('系列【'+this.form.tableData[i].product_series+'】工序未设置完成,请检查!', CRUD.NOTIFICATION_TYPE.INFO)
this.crud.notify('系列【' + this.form.tableData[i].product_series + '】工序未设置完成,请检查!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}

View File

@@ -18,6 +18,22 @@
placeholder="选择时间"
/>
</el-form-item>
<el-form-item label="关键设备" prop="device_id">
<el-select
v-model="infoscope.device_id"
size="mini"
placeholder="关键设备"
class="filter-item"
disabled
style="width: 210px"
>
<el-option
v-for="item in Devices"
:key="item.id"
:label="item.name"
:value="item.id"
/></el-select>
</el-form-item>
<el-form-item label="类型:" prop="holidayType">
<el-select v-model="infoscope.holidayType" size="small" placeholder="请选择类型" clearable>
<el-option label="休息日" value="01" />
@@ -34,12 +50,14 @@
<script>
import crudCalendar, { updateDtlStatus } from '@/api/wms/pdm/factoryCalendar'
import producetask from '@/api/wms/pdm/producetask'
export default {
data() {
return {
drawer: false,
title: '1',
Devices: [],
infoscope: {
holidayDate: [],
holidayType: '',
@@ -55,11 +73,15 @@ export default {
}
}
},
created() {
producetask.getDevices().then(res => {
this.Devices = res
})
},
methods: {
sure() {
this.$refs.infoscope.validate(val => {
if (val) {
debugger
crudCalendar.updateDtlStatus(this.infoscope).then(res => {
this.$message.success('修改成功')
this.drawer = false

View File

@@ -20,6 +20,25 @@
@keyup.enter.native="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.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<rrOperation />
</el-form>
</div>
@@ -141,6 +160,26 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-bottom: 5px;">
<el-col :span="12">
<el-form-item label="关键设备" prop="device_id">
<el-select
v-model="form.device_id"
size="mini"
placeholder="关键设备"
class="filter-item"
:disabled="crud.status.edit > 0"
style="width: 210px"
>
<el-option
v-for="item in Devices"
:key="item.id"
:label="item.name"
:value="item.id"
/></el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-bottom: 5px;">
<el-form-item label="工作日" required>
<el-col :span="4" />
@@ -245,8 +284,9 @@
>
<el-table-column type="selection" width="55" />
<el-table-column prop="factorycalendar_code" label="工厂日历编码" />
<el-table-column prop="factorycalendar_name" label="工厂日历名称" />
<el-table-column prop="factorycalendar_name" min-width="120" label="工厂日历名称" />
<el-table-column prop="name" label="所属组织" />
<el-table-column prop="device_name" min-width="80" label="关键设备" />
<el-table-column prop="startfactory_year" label="开始年份" />
<el-table-column prop="endfactory_year" label="终止年份" />
<el-table-column prop="factorycale_startdate" label="工厂初始日期" />
@@ -281,6 +321,7 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import ladrawer from '@/views/wms/pdm/base/factoryCalendar/AddDialog'
import factoryCalendar from '@/api/wms/pdm/factoryCalendar'
import producetask from '@/api/wms/pdm/producetask'
const defaultForm = {
factorycalendar_id: null,
@@ -291,6 +332,7 @@ const defaultForm = {
endfactory_year: null,
factorycale_startdate: null,
remark: null,
device_id: null,
is_mon: '0',
is_tue: '0',
is_wed: '0',
@@ -320,6 +362,7 @@ export default {
queryDate: [], // 查询的日期
calendarData: [], // 所有假期对应的日期
value: '',
Devices: [],
year: new Date().getFullYear(),
permission: {},
update_calendar: false,
@@ -330,6 +373,9 @@ export default {
factorycalendar_name: [
{ required: true, message: '工厂日历名称不能为空', trigger: 'blur' }
],
device_id: [
{ required: true, message: '关键设备不能为空', trigger: 'blur' }
],
factorycale_startdate: [
{ required: true, message: '工厂初始日期不能为空', trigger: 'blur' }
],
@@ -374,6 +420,11 @@ export default {
})
})
},
created() {
producetask.getDevices().then(res => {
this.Devices = res
})
},
methods: {
// 新增与编辑前做的操作
[CRUD.HOOK.afterToCU](crud, form) {
@@ -528,6 +579,9 @@ export default {
}
})
},
hand(value) {
this.crud.toQuery()
},
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {

View File

@@ -0,0 +1,212 @@
<template>
<el-dialog
width="800px"
:visible.sync="dialogVisible"
:show-close="false"
@close="close"
>
<span slot="title" class="dialog-footer">
<div class="crud-opts2">
<span class="el-dialog__title2">月计划修改</span>
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<el-button slot="left" type="info" @click="dialogVisible = false">关闭</el-button>
<el-button slot="left" type="primary" @click="submit">保存</el-button>
</span>
</div>
</span>
<el-form ref="form" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;" :inline="true" :model="form" size="mini" label-width="120px" label-suffix=":">
<el-form-item label="计划月份" prop="plan_code">
<label slot="label">计划月份:</label>
<el-input v-model="form.plan_month" disabled clearable style="width: 210px" />
</el-form-item>
<el-form-item label="任务号" prop="task_code">
<label slot="label">任务号:</label>
<el-input v-model="form.task_code" style="width: 210px" disabled/>
</el-form-item>
<el-form-item label="申报单位" prop="plan_org_name">
<label slot="label">申报单位:</label>
<el-input v-model="form.plan_org_name" style="width: 210px" disabled/>
</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.name"
:value="item.id"
/></el-select>
</el-form-item>
<el-form-item label="交货日期" prop="plan_finish_date">
<label slot="label">交货日期:</label>
<el-input v-model="form.plan_finish_date" style="width: 210px" disabled/>
</el-form-item>
<el-form-item label="牌号" prop="old_mark">
<label slot="label">牌号:</label>
<el-input v-model="form.old_mark" style="width: 210px" disabled/>
</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/>
</el-form-item>
<el-form-item label="系列" prop="product_series">
<el-select
v-model="form.product_series"
placeholder=""
style="width: 210px"
class="filter-item"
disabled
>
<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="生产重量Kg" prop="fact_weight">
<label slot="label">生产重量Kg:</label>
<el-input-number
v-model="form.fact_weight"
:controls="false"
:precision="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="每批重量Kg" prop="standard_weight">
<label slot="label">每批重量Kg:</label>
<el-input-number
v-model="form.standard_weight"
:controls="false"
:precision="0"
disabled
style="width: 210px"
/>
</el-form-item>
<el-form-item label="状态" prop="is_proc">
<el-select
v-model="form.is_proc"
placeholder=""
style="width: 210px"
class="filter-item"
disabled
>
<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="提交人" prop="update_optname">
<label slot="label">提交人:</label>
<el-input v-model="form.update_optname" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="提交时间" prop="update_time">
<label slot="label">提交时间:</label>
<el-input v-model="form.update_time" style="width: 210px" disabled />
</el-form-item>
<el-form-item label="备注" prop="remark">
<label slot="label">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
<el-input v-model="form.remark" style="width: 480px;" rows="3" type="textarea" disabled />
</el-form-item>
</el-form>
</el-dialog>
</template>
<script>
import crudseriesProcessRoute from '@/api/wms/pdm/seriesProcessRoute'
import workorder from '@/api/wms/pdm/workorder'
import producetask from '@/api/wms/pdm/producetask'
export default {
name: 'AddDialog',
components: { },
props: {
dialogShow: {
type: Boolean,
default: false
},
rowmst: {
type: Object
}
},
dicts: ['product_series', 'is_proc2'],
data() {
return {
dialogVisible: false,
fullscreenLoading: false,
Depts: [],
Devices: [],
XLList: [],
form: {}
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
},
rowmst: {
handler(newValue) {
this.form = 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('update:dialogShow', false)
this.form = {}
this.$emit('AddChanged')
},
submit() {
producetask.submit3(this.form).then(res => {
debugger
this.$emit('update:dialogShow', false)
this.form = {}
this.$emit('AddChanged')
})
}
}
}
</script>
<style>
.crud-opts2 {
padding: 0 0;
display: -webkit-flex;
display: flex;
align-items: center;
}
.crud-opts2 .crud-opts-right2 {
margin-left: auto;
padding: 4px 4px;
}
.input-with-select {
background-color: #fff;
}
</style>

View File

@@ -154,6 +154,16 @@
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column
min-width="125"
label="操作"
align="center"
fixed="right"
>
<template scope="scope">
<el-button :disabled="scope.row.is_proc==='2'" type="primary" class="filter-item" size="mini" icon="el-icon-edit" @click="handleEdit(scope.$index, scope.row)"></el-button>
</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_month" label="计划月份" />
@@ -164,7 +174,6 @@
<el-table-column prop="old_mark" min-width="100" 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="生产重量Kg" :formatter="crud.formatNum0" min-width="95" />
<el-table-column prop="standard_weight" label="每批重量Kg" width="95" :formatter="crud.formatNum0"/>
<el-table-column prop="pcsn_num" label="批数" :formatter="pcsn_num_format"/>
@@ -176,6 +185,7 @@
<!--分页组件-->
<pagination />
</div>
<AddDialog :dialog-show.sync="changeShow" :rowmst="mstrow" @AddChanged="querytable" />
</div>
</template>
@@ -184,6 +194,7 @@ 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 AddDialog from '@/views/wms/pdm/produce/mouthtask/AddDialog'
import pagination from '@crud/Pagination'
import { getToken } from '@/utils/auth'
import { mapGetters } from 'vuex'
@@ -194,12 +205,17 @@ import Date from '@/utils/datetime'
export default {
name: 'mouthtask',
dicts: ['product_mode', 'is_proc2'],
components: { pagination, crudOperation, rrOperation },
components: { pagination, crudOperation, rrOperation, AddDialog },
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
title: '月计划管理',
url: 'api/producetask/mouthtask',
permission: {
add: ['admin', 'producetask:add'],
edit: ['admin', 'producetask:edit'],
del: ['admin', 'producetask:del']
},
idField: 'plan_id',
sort: '',
query:{ nowstart_date: new Date(), captemplate_id: '',is_proc: '1'},
@@ -217,6 +233,8 @@ export default {
dialogVisible: false,
save_flag: true,
sub_flag: true,
changeShow: false,
mstrow: {},
Depts: [],
Devices: [],
Capacitytes: [],
@@ -256,6 +274,9 @@ export default {
}
return true
},
canUd(row) {
return row.is_proc !== '2'
},
checkboxT(row) {
return row.is_proc === '1'
},
@@ -286,6 +307,10 @@ export default {
}
}
},
handleEdit(index, row) {
this.changeShow = true
this.mstrow = row
},
save() {
if(this.crud.query.captemplate_id === '' || this.crud.query.captemplate_id === undefined ){
this.crud.notify('请先选择排产模板!')

View File

@@ -66,7 +66,25 @@
@keyup.enter.native="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.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item label="状态">
<el-select
v-model="query.is_proc"
@@ -171,11 +189,11 @@
<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="device_name" label="关键设备" />
<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" min-width="100" label="牌号" />
<el-table-column prop="product_type_name" label="生产方式" />
<el-table-column prop="product_weight" label="需求重量" :formatter="crud.formatNum0"/>
<el-table-column prop="fact_weight" label="生产重量" :formatter="crud.formatNum0" width="150" align="center">
<template scope="scope">
@@ -208,6 +226,7 @@ import udOperation from '@crud/UD.operation'
import { getToken } from '@/utils/auth'
import { mapGetters } from 'vuex'
import workorder from '@/api/wms/pdm/workorder'
import producetask from '@/api/wms/pdm/producetask'
export default {
name: 'producetask',
@@ -238,6 +257,7 @@ export default {
nowAction: this.baseApi + '/api/producetask/importExcel/1',
Depts: [],
fileList: [],
Devices: [],
fullscreenLoading: false,
checkrows: [],
permission: {
@@ -259,6 +279,9 @@ export default {
workorder.getDepts().then(res => {
this.Depts = res
})
producetask.getDevices().then(res => {
this.Devices = res
})
},
methods: {
[CRUD.HOOK.beforeRefresh]() {

View File

@@ -187,6 +187,9 @@ export default {
workorder_type: [
{ required: true, message: '工令类型不能为空', trigger: 'blur' }
],
device_id: [
{ required: true, message: '关键设备不能为空', trigger: 'blur' }
],
org_id: [
{ required: true, message: '所属组织不能为空', trigger: 'blur' }
],