Commit d4887bbf authored by Scott Sun's avatar Scott Sun

scott

parent 6423c068
{
"presets" :["es2015"],
"plugins": []
}
\ No newline at end of file
## vivo
* 100 102~106 108~113 115~116 119~127 129~130 132~142 145~150 rar压缩包
* 107 114 117 118 128 131无文件
* 144 创建profile失败
\ No newline at end of file
"use strict";
var fs = require("fs");
var db = require('topsin.database');
var user_name = "Sys";
try {
db.addConnection({
databse_type: 'pg',
database_host: '10.90.2.100:5432',
database_name: 'TOPSTQ_ATS_V6',
database_user: 'toplinker',
database_pwd: 'TopLinker0510'
}, "ATS_DFM_DB");
var query_1 = db.query('ATS_DFM_DB');
// 1.获取客户名称
var customers_1 = query_1.selectArrayValue({
table: 'pub_customer',
field: "code"
});
if (query_1.lastError().isValid())
throw query_1.lastError().text();
// 获取远程文件夹
var samba = fs.listDir("\\\\10.90.2.100\\samba", 0);
var sambaDirs_1 = [];
var sambaFiles_1 = [];
samba.forEach(function (v) {
if (v.isDir) {
sambaDirs_1.push(v);
}
else {
sambaFiles_1.push(v);
}
});
sambaDirs_1.forEach(function (v) {
if (customers_1.indexOf(v.name) >= 0) {
// 获取该客户下所有料号
var jobs = fs.listDir("\\\\10.90.2.100\\samba\\" + v.name, 0).filter(function (v) { return v.isDir; });
// 获取dfm种已经存在的料号名
var dfm_jobs_1 = query_1.selectArrayValue({
table: 'pdm_job',
field: "jobname",
where: { customer_code: v.name },
order: 'id DESC'
});
// 循环判断新料号
jobs.forEach(function (v2) {
if (/_/.test(v2.name) && dfm_jobs_1.indexOf(v2.name) < 0) {
// 为该新料号创建报价
var jobId = query_1.insertRow({
table: 'pdm_job',
data: {
jobname: v2.name,
version: '',
customer_code: v.name,
job_type: "normal",
spec_list: "{" + v.name + ",__GENERAL__}",
job_status: "active",
job_attrs: { "vc_number": v2.name.split("_")[0], "vc_position": v2.name.split("_")[1] },
action_data: { "create_time": query_1.getNow(), "create_user_id": 1, "create_user_name": user_name },
sys_data: { "sys_data_version": 0 },
spec_mode: 0
},
return_field: 'id'
});
if (query_1.lastError().isValid())
throw query_1.lastError().text();
var flowInfo = query_1.selectMap({
table: 'pdm_aimdfm_workflow',
where: {
name: "topcam"
}
});
var flowId = flowInfo["id"];
var flowTitle = flowInfo["title"];
// 创建料号任务
query_1.insertRow({
table: 'pdm_aimdfm_task',
data: {
job_id: jobId,
flow_id: flowId,
status: 'waiting',
user_id: 1,
user_name: user_name,
priority: 0,
task_title: v2.name + ":" + flowTitle
}
});
if (query_1.lastError().isValid())
throw query_1.lastError().text();
}
});
}
});
}
catch (error) {
console.log("err");
console.log(error);
}
let fs = require("fs");
let db = require('topsin.database');
const user_name = "Sys";
try {
db.addConnection({
databse_type:'pg',
database_host:'10.90.2.100:5432',
database_name:'TOPSTQ_ATS_V6',
database_user:'toplinker',
database_pwd:'TopLinker0510'
}, "ATS_DFM_DB");
let query = db.query('ATS_DFM_DB');
// 1.获取客户名称
let customers = query.selectArrayValue({
table:'pub_customer',
field:"code"
});
if (query.lastError().isValid()) throw query.lastError().text();
// 获取远程文件夹
let samba = fs.listDir("\\\\10.90.2.100\\samba", 0)
let sambaDirs:any[] = [];
let sambaFiles:any[] = [];
samba.forEach((v:any) => {
if (v.isDir) {
sambaDirs.push(v)
} else {
sambaFiles.push(v)
}
})
sambaDirs.forEach((v:any) => {
if(customers.indexOf(v.name) >= 0) {
// 获取该客户下所有料号
let jobs = fs.listDir("\\\\10.90.2.100\\samba\\" + v.name, 0).filter((v:any) => v.isDir)
// 获取dfm种已经存在的料号名
let dfm_jobs = query.selectArrayValue({
table:'pdm_job',
field:"jobname",
where: { customer_code: v.name} ,
order:'id DESC'
});
// 循环判断新料号
jobs.forEach((v2:any) => {
if ( /_/.test(v2.name) && dfm_jobs.indexOf(v2.name) < 0) {
// 为该新料号创建报价
let jobId = query.insertRow({
table:'pdm_job',
data:{
jobname:v2.name,
version: '',
customer_code:v.name,
job_type:"normal",
spec_list:`{${v.name},__GENERAL__}`,
job_status:"active",
job_attrs: {"vc_number": v2.name.split("_")[0], "vc_position": v2.name.split("_")[1]},
action_data: {"create_time": query.getNow(), "create_user_id": 1, "create_user_name": user_name}, // ?
sys_data: {"sys_data_version": 0},
spec_mode:0
},
return_field:'id'
});
if (query.lastError().isValid()) throw query.lastError().text();
var flowInfo = query.selectMap({
table: 'pdm_aimdfm_workflow',
where: {
name: "topcam"
}
});
var flowId = flowInfo["id"];
var flowTitle = flowInfo["title"];
// 创建料号任务
query.insertRow({
table: 'pdm_aimdfm_task',
data: {
job_id: jobId,
flow_id: flowId,
status: 'waiting',
user_id: 1,
user_name:user_name,
priority: 0,
task_title: `${v2.name}:${flowTitle}`
}
});
if (query.lastError().isValid()) throw query.lastError().text();
}
})
}
})
}
catch (error) {
console.log("err");
console.log(error);
}
let mail = require('topsin.mail');
let error = require('topsin.error');
var err = mail.sendMail({
host:'smtp.exmail.qq.com',
auth_method:mail.AuthMethod.LOGIN,
connection_type:mail.ConnectionType.TCP,
from:'scott.sun@topibd.com',
password:'159482673Sun',
to:'scott.sun@topibd.com',
subject:'customer_code / job_name reading is ready!',
content:'customer_code / job_name reading is ready!'
});
if (err.isValid()) {
print(err.text());
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
"removeComments": false, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
"noImplicitThis": false, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
}
This diff is collapsed.
......@@ -71,7 +71,8 @@ var resultData = [];
var par = PAR;
var default_par = {
step: "orig",
auto_save: "No",
auto_save: "No",
units:"mm"
}
for(var key in default_par){ if (!par.hasOwnProperty(key) || par[key] == ""){ par[key] = default_par[key] }}
var job = Job;
......@@ -80,26 +81,26 @@ try {
if(!GEN.isJobExists({job:job})){throw "料号"+job+"不存在"}
if(!GEN.isJobOpen({job:job})){ GEN.openJob({job:job}) }
if(mode == "aimdfm"){ if(GEN.checkInout({job:job,mode:"test"}) != 0){ throw "the job check" } else { GEN.checkInout({job:job,mode:"out"}) } }
var stepList = GEN.getStepList({job:job})
stepList = stepList.filter(function(step){
var reg = new RegExp(par.step,"ig")
return reg.test(step)
})
stepList.forEach(function(step){
GEN.openStep({job:job,name:step})
GEN.clearLayers(); //清除层显示
GEN.affectedLayer({ mode: 'all', affected: 'no' }); //设置影响层全部不影响
GEN.COM("sel_options,clear_mode=clear_after,display_mode=all_layers,area_inout=inside,area_select=select,select_mode=standard,area_touching_mode=exclude");
GEN.units({ type: par.units });
GEN.zoomHome();
GEN.closeStep()
})
......
require("topsin.genmath")
var genMath = new GenMath();
function featsToLimits(feats) {
feats.forEach(function(item) {
if(item.feats) {
var polygon = genMath.profile2Polygon(item.feats.join("\n"),0)
var res = polygon.reduce(function(a,b){
a.xmin = b.x > a.xmin ? a.xmin : b.x;
a.ymin = b.y > a.ymin ? a.ymin : b.y;
a.xmax = b.x < a.xmax ? a.xmax : b.x;
a.ymax = b.y < a.ymax ? a.ymax : b.y;
return a
}, {
xmin: polygon[0].x,
ymin: polygon[0].y,
xmax: polygon[0].x,
ymax: polygon[0].y
})
res.xsize = Math.abs(res.xmax - res.xmin)
res.ysize = Math.abs(res.ymax - res.ymin)
res.xc = res.xmin + res.xsize/2
res.yc = res.ymin + res.ysize/2
item.limits = res
}
})
}
function changeLine(line, length) {
line.xs = Number(line.xs)
line.ys = Number(line.ys)
line.xe = Number(line.xe)
line.ye = Number(line.ye)
if (line.xe - line.xs == 0 || line.ye - line.ys == 0) {
if (line.xe - line.xs == 0 ) {
return {
xs: line.xs,
ys: line.ys + (line.ye - line.ys > 0 ? -length : length),
xe: line.xe,
ye: line.ye + (line.ye - line.ys > 0 ? length : -length)
}
} else {
return {
xs: line.xs - (line.xe - line.xs > 0 ? length : -length),
ys: line.ys,
xe: line.xe - (line.xe - line.xs > 0 ? -length : length),
ye: line.ye
}
}
}
var width = Math.sqrt( (line.xe - line.xs)*(line.xe - line.xs) + (line.ye - line.ys)*(line.ye - line.ys) )
var k = length / width;
var x = line.xe - line.xs;
var y = line.ye - line.ys;
return {
xs: line.xs - k * x,
ys: line.ys - k * y,
xe: line.xe + k * x,
ye: line.ye + k * y
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment