This commit is contained in:
parent
33948a0bac
commit
74d0818775
@ -123,15 +123,16 @@ class SetWipOutput
|
||||
}
|
||||
$subbatch = $ret['subbatch'];
|
||||
// 拿到工序编码
|
||||
foreach (json_decode($ret['process'], true) as $key => $val) {
|
||||
$ret_process = json_decode($ret['process'], true);
|
||||
// 拿到工序编码
|
||||
foreach ($ret_process as $key => $val) {
|
||||
if ($val[4] == $workingsubclass) {
|
||||
if (isset($process[$key + 1])) {
|
||||
$next_process_code = $process[$key + 1][2];
|
||||
if (isset($ret_process[$key + 1])) {
|
||||
$next_process_code = $ret_process[$key + 1][2];
|
||||
}
|
||||
$process_code = $val[2];
|
||||
}
|
||||
}
|
||||
|
||||
//4.通过以上关联信息查询物料编码
|
||||
$sql = "SELECT a.flow_id,e.code as bom_source_code,e.name as bom_source_name,d.bom_source_id,d.bom_id,f.code as bom_source_category_code FROM hf_mes_production_planning_management_batch a
|
||||
INNER JOIN hf_mes_technology_flow b ON a.flow_id = b.id
|
||||
@ -321,24 +322,25 @@ class SetWipOutput
|
||||
$uuid = json_encode(array_unique($uuid));
|
||||
}
|
||||
//保证每个正向追溯的uuid都是唯一的
|
||||
$forward_tracing_uuid_only[] = generateUniqueId();
|
||||
$forward_tracing_uuid_only = json_encode($forward_tracing_uuid_only);
|
||||
$decoded_uuid = json_decode($forward_tracing_uuid_only, true);
|
||||
if (is_array($decoded_uuid)) {
|
||||
$forward_tracing_uuid = array_merge($forward_tracing_uuid, $decoded_uuid);
|
||||
}
|
||||
$forward_tracing_uuid = json_encode(array_unique($forward_tracing_uuid));
|
||||
$forward_tracing_uuid = json_encode(array_unique(array_merge($forward_tracing_uuid, [generateUniqueId()])));
|
||||
|
||||
$wip_uuid = count($wip_uuid) <= 0 ? $uuid : json_encode(array_values(array_unique($wip_uuid)));
|
||||
$now_date = date('Y-m-d H:i:s');
|
||||
$start_time = $last_time; //isset($param_out['START_TIME'])? $param_out['START_TIME'] : date('Y-m-d H:i:s');
|
||||
$finish_time = isset($param_out['FINISH_TIME']) ? $param_out['FINISH_TIME'] : date('Y-m-d H:i:s');
|
||||
$lot = strtotime($now_date);
|
||||
$wip_msg = generate_material_item_id_wip($workingsubclass, $device_code, $batch, $cut_list, $gun_count, $roller_press_batch);
|
||||
$wip_msg = generate_material_item_id_wip($workingsubclass, $device_code, $batch, $cut_list);
|
||||
if (!$wip_msg[0]) {
|
||||
throw new Exception("获取物料批次条码失败!" . $wip_msg[1]);
|
||||
} else {
|
||||
$battery_id = $wip_msg[1];
|
||||
}
|
||||
//判断物料批次条码是否已经存在于生产批次中如果存在则提示失败
|
||||
$sql = 'SELECT id FROM "hf_mes_tmp_bkv_' . $subbatch . '" WHERE battery_id = \'' . $wip_msg[1] . '\' AND active = 1';
|
||||
$ret = Db::fetch($sql);
|
||||
if (!empty($ret)) {
|
||||
throw new Exception("产出批次【$wip_msg[1]】已经激活了,不要重复产出!");
|
||||
}
|
||||
// 新增数据到process_log表
|
||||
//返回需要使用的数据
|
||||
$data_list = array_merge($data_list, [$battery_id, $bom_relationship_array['bom_source_code'], $bom_relationship_array['bom_source_name'], $batch, $device_code]);
|
||||
@ -401,14 +403,15 @@ class SetWipOutput
|
||||
}
|
||||
|
||||
// 新增数据到bkv表
|
||||
$wip_bkv_sql_head = 'INSERT INTO "hf_mes_tmp_bkv_' . $subbatch . '" (battery_id, tray, lot, active, process_code, item_code, item_name, item_batch, item_quantity, item_batch_start_time, pid, uuid, bom_source_id, bom_id, ' . implode(',', $sql_key_out_result_param) . ') VALUES ';
|
||||
$wip_bkv_sql_head = 'INSERT INTO "hf_mes_tmp_bkv_' . $subbatch . '" (battery_id, tray, lot, active, process_code, next_process_code, item_code, item_name, item_batch, item_quantity, item_batch_start_time, pid, uuid, bom_source_id, bom_id, ' . implode(',', $sql_key_out_result_param) . ') VALUES ';
|
||||
$wip_bkv_sql_val = sprintf(
|
||||
"('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',%s)",
|
||||
"('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s',%s)",
|
||||
$battery_id,
|
||||
'-1',
|
||||
$lot,
|
||||
1,
|
||||
$process_code,
|
||||
$next_process_code,
|
||||
$bom_relationship_array['bom_source_code'],
|
||||
$bom_relationship_array['bom_source_name'],
|
||||
$battery_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user