ATS_AIM_checkin.js 2.58 KB
Newer Older
Scott Sun's avatar
Scott Sun committed
1 2 3 4 5 6 7


/*
NAME: 
DESCRIPTION: ;
PARAMETER:
    [
Scott Sun's avatar
Scott Sun committed
8 9 10 11 12 13
        {
			name : 'config_path',
			title : '配置地址',
			type : 'LineEdit',
			property : {tool_tip : '配置的路径'},
		}
Scott Sun's avatar
Scott Sun committed
14 15 16
	]
	
 VERSION_HISTORY:
Scott Sun's avatar
Scott Sun committed
17
	V1.01 2020-04-20 Scott Sun
Scott Sun's avatar
Scott Sun committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
	    1.新版本
		
 HELP:
 	<html><body bgcolor="#DDECFE">
		<font size="3" color="#003DB2"><p>功能简介</p></font>
		<p> checkin </p>
		<br>
		<font size="3" color="#003DB2"><p>参数配置</p></font>
		<p> 料号 和 客户配置 </p>
		<br>
		<font size="3" color="#003DB2"><p>注意事项</p></font>
		<p> 无 </p>
		<br>
	</body></html>	
*/
//////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////
// 引入模块 包

var $ = require('topcam.scriptfunc').argv();
var fs = require('fs');
var _ = require('lodash');
var process = require('process');
var mode = $.ikm ? "topcam" : "aimdfm";
var IKM = $.ikm; 
if (IKM==undefined ) { IKM = require('topcam.ikm6')($) }
var GEN = $.gen;
var GUI = $.gui || {};
var Job = $.job || $.job_name;
var JobId = $.job_id;
var db = $.db || IKM.db
var PAR = {}
if ($.par) {
	PAR = $.par
} else if ($.hasOwnProperty('script_parameter')){
	PAR = JSON.parse($.script_parameter);
}

if (mode === "aimdfm") {
	var database = require("topsin.database");
	database.addConnection($.conf.database_conf, "DFM");
	var QDfm = database.query("DFM");
	$.QDfm = QDfm;
	if ($.conf.product_type == "aimdfm") {
		QDfm.updateRow({
			table: "pdm_aimdfm_task",
			data: {
				current_process_title: $.process_title,
				progress: 0
			},
			where: { id: $.task_id }
		});
	}
}
var Status = 'ok';
var resultData = [];
try {
Scott Sun's avatar
Scott Sun committed
75
	console.log("=============================check in====================");
Scott Sun's avatar
Scott Sun committed
76 77 78 79 80
	// GEN.COM("open_job,job="+Job+",open_win=no,disk_map=,job_map=")
	// GEN.AUX("set_group,group=99")
	// GEN.COM("close_job,job="+Job+"")
	// GEN.COM("disp_on")
	// GEN.COM("origin_on")
Scott Sun's avatar
Scott Sun committed
81 82 83
	GEN.COM("disp_on")
	GEN.COM("origin_on")
	GEN.COM("checkin_closed_job,job="+Job);
Scott Sun's avatar
Scott Sun committed
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
	if (mode === "aimdfm") {
		if (GEN.hasError()) {
			Status = 'error';
			resultData.push({ type: "error", title: "GEN错误!", detail: [{ desc: _.join(GEN.STATUS, "\n") }] });
			return {
				status: Status,
				result_data: resultData
			};
		} else {
			resultData.push({ type: "info", title: "操作完成, 请注意检查!" });
			return {
				status: Status,
				result_data: resultData
			};
		}
	}else {
		return "Done"
	}	
Scott Sun's avatar
Scott Sun committed
102 103 104 105 106 107
}
catch (e) {
    Status = 'error';
    resultData.push({type: "error", title: "脚本执行出错!", detail: [{desc: _.toString(e)}]});
	return (mode === "aimdfm") ? {status: Status, result_data: resultData} : "Error";
}