|
|
////#include "dfl_custom.h"
|
|
|
////#include <tc/envelope.h>
|
|
|
////#include <base_utils/IFail.hxx>
|
|
|
////#include <base_utils/TcResultStatus.hxx>
|
|
|
////#include <tccore/aom_prop.h>
|
|
|
////#include "ado.h"
|
|
|
////#include <tccore\aom.h>
|
|
|
////#include <tccore\aom_prop.h>
|
|
|
////#include "rapidjson/document.h"
|
|
|
////#include <tccore/uom.h>
|
|
|
////#include "rapidjson/writer.h"
|
|
|
////#include <sstream>
|
|
|
////#include <iostream>
|
|
|
////#include <fstream>
|
|
|
////#include "ocilib.h"
|
|
|
////#include <regex>
|
|
|
////#include <tccore/grm.h>
|
|
|
////#include <bom/bom.h>
|
|
|
////#include <cfm/cfm.h>
|
|
|
////#include <me/me.h>
|
|
|
////#include <property/nr.h>
|
|
|
////#include <tccore/aom.h>
|
|
|
////#include <tccore/item.h>
|
|
|
////#include <tccore/workspaceobject.h>
|
|
|
////using namespace std;
|
|
|
////
|
|
|
////typedef struct {
|
|
|
//// string cpxh;//产品型号 低、中、高、调、稳
|
|
|
//// string dyxq;
|
|
|
//// string zyxq;
|
|
|
//// string gyxq;
|
|
|
//// string tyxq;
|
|
|
//// string wyxq;
|
|
|
////}ByqBean;
|
|
|
////typedef struct {
|
|
|
//// string rgsj;//产品型号 低、中、高、调、稳
|
|
|
//// string jqsj;
|
|
|
//// string zbsj;
|
|
|
//// string zrsczq;
|
|
|
////}TimeBean;
|
|
|
////typedef struct {
|
|
|
//// string temGxCode;
|
|
|
//// string temGxName;
|
|
|
////
|
|
|
////}TemGxBean;
|
|
|
////string sqlRxfs = "select \"TarGXCODE\", \"TarGXNAME\", \"TemGXCODE\", \"TemGXNAME\" from \"CHINT_WORKHOUR_WhGXName\" where \"WindStyle\" = '%s'";
|
|
|
////string sqlGyRule = "select GYID from \"CHINT_WORKHOUR_WhGYRule\" where \"ProductZu\" = '%s' and \"TuHao\" = '%s'";
|
|
|
////string sqlCpxh = "SELECT \"ProductZu\" FROM \"CHINT_WORKHOUR_WhProductXH\" where \"ProductXH\" = '%s'";
|
|
|
////string sqlGxTime = "select GXCODE,ARTIFICIALTIME,MACHINETIME,READINESSTIME,\"ProCycle\" from CHINT_WORKHOUR where \"PRODUCTXH\" = '%s' and GYID = '%s'";
|
|
|
////void save_representation(tag_t primaryTag, tag_t secondTag, char* relationType)
|
|
|
////{
|
|
|
//// tag_t typeTag = NULLTAG;
|
|
|
//// ITKCALL(GRM_find_relation_type(relationType, &typeTag));
|
|
|
////
|
|
|
//// ITKCALL(AOM_refresh(primaryTag, TRUE));
|
|
|
//// ITKCALL(AOM_refresh(secondTag, TRUE));
|
|
|
//// tag_t relationTag = NULLTAG;
|
|
|
//// ITKCALL(GRM_create_relation(primaryTag, secondTag, typeTag, NULLTAG, &relationTag));//如果关系已经存在,那么就是增加对象
|
|
|
////
|
|
|
//// ITKCALL(GRM_save_relation(relationTag));//很必要
|
|
|
//// ITKCALL(AOM_save(primaryTag));
|
|
|
//// ITKCALL(AOM_save(secondTag));
|
|
|
//// ITKCALL(AOM_refresh(primaryTag, FALSE));
|
|
|
//// ITKCALL(AOM_refresh(secondTag, FALSE));
|
|
|
////}
|
|
|
////void updateTemGxCode(tag_t processTag, map<string, TemGxBean> temGxMap) {
|
|
|
//// int bvr_count = 0;
|
|
|
//// tag_t ebom_window = NULLTAG;
|
|
|
//// tag_t bom_line = NULLTAG;
|
|
|
//// tag_t item_tag = NULLTAG, * c_line_tags;
|
|
|
//// (BOM_create_window(&ebom_window));
|
|
|
//// tag_t* bvr_list = NULL;
|
|
|
//// (ITEM_rev_list_bom_view_revs(processTag, &bvr_count, &bvr_list));
|
|
|
//// printf("bvr_count=%d", bvr_count);
|
|
|
////
|
|
|
//// (BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
|
|
|
//// //bom_line工艺
|
|
|
//// int c_line_count;
|
|
|
//// ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); // 一级工序
|
|
|
//// for (int i = 0; i < c_line_count; i++) {
|
|
|
//// tag_t oneGxLine = c_line_tags[i], * towGxLines,oneGx, gxItem;
|
|
|
//// char* gxbm1;
|
|
|
//// AOM_ask_value_string(oneGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm1);
|
|
|
////
|
|
|
//// printf("gxbm1===>%s\n", gxbm1);
|
|
|
//// if (temGxMap.count(gxbm1) > 0) {
|
|
|
//// char* oldName;
|
|
|
//// TemGxBean temGxBean = temGxMap[gxbm1];
|
|
|
//// AOM_lock(oneGxLine);
|
|
|
//// AOM_set_value_string(oneGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", temGxBean.temGxCode.c_str());
|
|
|
//// AOM_save(oneGxLine);
|
|
|
//// AOM_unlock(oneGxLine);
|
|
|
//// ITKCALL(AOM_ask_value_tag(oneGxLine, "bl_line_object", &oneGx));
|
|
|
//// ITKCALL(ITEM_ask_item_of_rev(oneGx, &gxItem));
|
|
|
//// ITKCALL(AOM_lock(gxItem));
|
|
|
//// ITKCALL(AOM_ask_value_string(gxItem, "object_name", &oldName));
|
|
|
//// ITKCALL(AOM_set_value_string(gxItem, "object_name", temGxBean.temGxName.c_str()));
|
|
|
//// ITKCALL(AOM_save(gxItem));
|
|
|
//// ITKCALL(AOM_unlock(gxItem));
|
|
|
//// ITKCALL(AOM_lock(oneGx));
|
|
|
//// ITKCALL(AOM_set_value_string(oneGx, "object_name", temGxBean.temGxName.c_str()));
|
|
|
//// ITKCALL(AOM_save(oneGx));
|
|
|
//// ITKCALL(AOM_unlock(oneGx));
|
|
|
//// printf("oldName===>%s\n", oldName);
|
|
|
//// printf("temGxName===>%s\n", temGxBean.temGxName.c_str());
|
|
|
//// printf("temGxCode===>%s\n", temGxBean.temGxCode.c_str());
|
|
|
//// }
|
|
|
////
|
|
|
//// int c_cnt = 0;
|
|
|
//// BOM_line_ask_all_child_lines(oneGxLine, &c_cnt, &towGxLines);
|
|
|
//// for (int j = 0; j < c_cnt; j++) {
|
|
|
//// tag_t towGxLine = towGxLines[j];
|
|
|
//// tag_t towGx, gxItem2;
|
|
|
//// char* gxbm2;
|
|
|
//// ITKCALL(AOM_ask_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm2));
|
|
|
////
|
|
|
//// printf("gxbm2===>%s\n", gxbm2);
|
|
|
//// if (temGxMap.count(gxbm2) > 0) {
|
|
|
//// TemGxBean temGxBean = temGxMap[gxbm2];
|
|
|
//// AOM_lock(towGxLine);
|
|
|
//// ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", temGxBean.temGxCode.c_str()));
|
|
|
//// AOM_save(towGxLine);
|
|
|
//// AOM_unlock(towGxLine);
|
|
|
//// char* oldName,* oldName2;
|
|
|
//// ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &towGx));
|
|
|
//// ITKCALL(ITEM_ask_item_of_rev(towGx, &gxItem2));
|
|
|
//// ITKCALL(AOM_lock(gxItem2));
|
|
|
//// ITKCALL(AOM_ask_value_string(gxItem2, "object_name", &oldName));
|
|
|
//// ITKCALL(AOM_set_value_string(gxItem2, "object_name", temGxBean.temGxName.c_str()));
|
|
|
//// ITKCALL(AOM_save(gxItem2));
|
|
|
//// ITKCALL(AOM_unlock(gxItem2));
|
|
|
//// ITKCALL(AOM_ask_value_string(gxItem2, "object_name", &oldName2));
|
|
|
//// printf("oldName===>%s\n", oldName);
|
|
|
//// printf("oldName2===>%s\n", oldName2);
|
|
|
//// printf("temGxName===>%s\n", temGxBean.temGxName.c_str());
|
|
|
//// printf("temGxCode===>%s\n", temGxBean.temGxCode.c_str());
|
|
|
//// ITKCALL(AOM_lock(towGx));
|
|
|
//// ITKCALL(AOM_set_value_string(towGx, "object_name", temGxBean.temGxName.c_str()));
|
|
|
//// ITKCALL(AOM_save(towGx));
|
|
|
//// ITKCALL(AOM_unlock(towGx));
|
|
|
////
|
|
|
//// }
|
|
|
////
|
|
|
//// }
|
|
|
//// }
|
|
|
//// BOM_close_window(ebom_window);
|
|
|
////}
|
|
|
////void getGxbmMap(tag_t processTag, map<string, tag_t>& gxDocMap, map<string, TimeBean > timebeans) {
|
|
|
//// int bvr_count = 0;
|
|
|
//// tag_t ebom_window = NULLTAG;
|
|
|
//// tag_t bom_line = NULLTAG;
|
|
|
//// tag_t item_tag = NULLTAG, * c_line_tags;
|
|
|
//// (BOM_create_window(&ebom_window));
|
|
|
//// tag_t* bvr_list = NULL;
|
|
|
//// (ITEM_rev_list_bom_view_revs(processTag, &bvr_count, &bvr_list));
|
|
|
//// printf("bvr_count=%d", bvr_count);
|
|
|
////
|
|
|
//// (BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
|
|
|
//// //bom_line工艺
|
|
|
//// int c_line_count;
|
|
|
//// ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags)); // 一级工序
|
|
|
////
|
|
|
//// for (int i = 0; i < c_line_count; i++) {
|
|
|
//// tag_t oneGx = c_line_tags[i], * towGxLines;
|
|
|
//// char* gxbm1;
|
|
|
//// AOM_ask_value_string(oneGx,"bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm1);
|
|
|
//// if (timebeans.count(gxbm1) > 0) {
|
|
|
//// AOM_lock(oneGx);
|
|
|
//// TimeBean tbean = timebeans[gxbm1];
|
|
|
//// ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ArtificialTime", tbean.rgsj.c_str()));
|
|
|
//// ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_MachineTime", tbean.jqsj.c_str()));
|
|
|
//// ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ReadinessTime", tbean.zbsj.c_str()));
|
|
|
//// ITKCALL(AOM_set_value_string(oneGx, "bl_ZT2_FirstOPRevision_zt2_ProductionCycle", tbean.zrsczq.c_str()));
|
|
|
//// AOM_save(oneGx);
|
|
|
//// AOM_unlock(oneGx);
|
|
|
//// }
|
|
|
//// int c_cnt = 0;
|
|
|
//// BOM_line_ask_all_child_lines(oneGx, &c_cnt, &towGxLines);
|
|
|
//// for (int j = 0; j < c_cnt; j++) {
|
|
|
//// tag_t towGxLine = towGxLines[j];
|
|
|
//// tag_t towGx;
|
|
|
//// char* gxbm2;
|
|
|
//// ITKCALL(AOM_ask_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ClassificationCode", &gxbm2));
|
|
|
//// if (timebeans.count(gxbm2) > 0) {
|
|
|
//// AOM_lock(towGxLine);
|
|
|
//// TimeBean tbean = timebeans[gxbm2];
|
|
|
//// printf("机器时间====>%s\n", tbean.jqsj.c_str());
|
|
|
//// ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ArtificialTime", tbean.rgsj.c_str()));
|
|
|
//// ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_MachineTime", tbean.jqsj.c_str()));
|
|
|
//// ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ReadinessTime", tbean.zbsj.c_str()));
|
|
|
//// ITKCALL(AOM_set_value_string(towGxLine, "bl_ZT2_FirstOPRevision_zt2_ProductionCycle", tbean.zrsczq.c_str()));
|
|
|
//// AOM_save(towGxLine);
|
|
|
//// AOM_unlock(towGxLine);
|
|
|
//// }
|
|
|
//// ITKCALL(AOM_ask_value_tag(towGxLine, "bl_line_object", &towGx));
|
|
|
//// gxDocMap[gxbm2] = towGx;
|
|
|
//// }
|
|
|
//// }
|
|
|
//// BOM_close_window(ebom_window);
|
|
|
////}
|
|
|
////tag_t clone_process_from_template(char* process_item_id,boolean isXq,string productZu, string xqfs)
|
|
|
////{
|
|
|
//// tag_t item_tag = NULLTAG;
|
|
|
//// ITKCALL(ITEM_find_item(process_item_id, &item_tag));
|
|
|
//// if (item_tag == NULLTAG)
|
|
|
//// {
|
|
|
//// printf("\n MEProcess NOT found! \n");
|
|
|
//// return NULLTAG;
|
|
|
//// }
|
|
|
//// tag_t revision_tag = NULLTAG;
|
|
|
//// ITKCALL(ITEM_ask_latest_rev(item_tag, &revision_tag));
|
|
|
//// char* nameOld,* item_revision_id;
|
|
|
//// AOM_ask_value_string(revision_tag, "item_revision_id", &item_revision_id);
|
|
|
//// AOM_ask_value_string(revision_tag,"object_name",&nameOld);
|
|
|
//// MEBOM_init_module();
|
|
|
////
|
|
|
//// tag_t window_tag = NULLTAG;
|
|
|
//// ITKCALL(ME_create_bop_window(&window_tag));
|
|
|
////
|
|
|
//// tag_t rule_tag = NULLTAG;
|
|
|
//// ITKCALL(CFM_find("Latest Working", &rule_tag));
|
|
|
////
|
|
|
//// ITKCALL(BOM_set_window_config_rule(window_tag, rule_tag));
|
|
|
//// //AOM_ask
|
|
|
//// char* next_id = NULL;
|
|
|
//// ITKCALL(NR_next_value("MEProcess", "item_id", NULLTAG, "", "", "",
|
|
|
//// NULLTAG, "", "", &next_id));
|
|
|
////
|
|
|
//// tag_t clone_tag = NULLTAG;
|
|
|
//// ITKCALL(ME_create_process_from_template(next_id, item_revision_id,
|
|
|
//// nameOld, "", revision_tag, rule_tag, window_tag,
|
|
|
//// "Process.Template.Mapping_Consumes", &clone_tag));
|
|
|
////
|
|
|
//// if (next_id) MEM_free(next_id);
|
|
|
////
|
|
|
//// ITKCALL(AOM_refresh(clone_tag, TRUE));
|
|
|
//// ITKCALL(AOM_save(clone_tag));
|
|
|
//// ITKCALL(AOM_refresh(clone_tag, FALSE));
|
|
|
////
|
|
|
//// char* item_id = NULL;
|
|
|
//// ITKCALL(WSOM_ask_id_string(clone_tag, &item_id));
|
|
|
////
|
|
|
//// printf("\n\t MEProcess Clone ID: %s\n", item_id);
|
|
|
//// ITKCALL(AOM_unload(clone_tag));
|
|
|
////
|
|
|
//// if (item_id != NULL)
|
|
|
//// MEM_free(item_id);
|
|
|
////
|
|
|
//// //复制“工艺守则”、“工序作业指导书”
|
|
|
////
|
|
|
//// if (isXq) {
|
|
|
//// char selectRxfs[200];
|
|
|
//// sprintf(selectRxfs, sqlRxfs.c_str(), xqfs.c_str());
|
|
|
//// int outputColumn1 = 0, outputValueCount1 = 0;
|
|
|
//// char*** outputValue1 = NULL;
|
|
|
//// printf("search3 ===> %s\n", selectRxfs);
|
|
|
//// QuerySQLNoInputParam(selectRxfs, &outputColumn1, &outputValueCount1, &outputValue1);
|
|
|
//// map<string, TemGxBean> temGxMap;
|
|
|
//// printf("search result ===> %d\n", outputValueCount1);
|
|
|
//// for (int num = 0; num < outputValueCount1; num++) {
|
|
|
//// //TarGXCODE\", \"TarGXNAME\", \"TemGXCODE\", \"TemGXNAME
|
|
|
//// string tarGxCode = outputValue1[num][0];
|
|
|
//// string tarGxName = outputValue1[num][1];
|
|
|
//// string temGxCode = outputValue1[num][2];
|
|
|
//// TemGxBean bean;
|
|
|
//// bean.temGxCode = tarGxCode;
|
|
|
//// bean.temGxName = tarGxName;
|
|
|
//// temGxMap[temGxCode] = bean;
|
|
|
//// }
|
|
|
//// //更新
|
|
|
//// updateTemGxCode(clone_tag, temGxMap);
|
|
|
//// }
|
|
|
//// //if (!isXq) {
|
|
|
//// map<string, tag_t> tmpProcessMap;
|
|
|
//// //vector<string> timeVec;
|
|
|
//// //工艺模板
|
|
|
//// map<string, TimeBean > beanMap;
|
|
|
//// getGxbmMap(revision_tag, tmpProcessMap, beanMap);
|
|
|
//// map<string, tag_t> newProcessMap;
|
|
|
//// char selectGyId[200];
|
|
|
//// sprintf(selectGyId, sqlGxTime.c_str(), productZu.c_str(), process_item_id);
|
|
|
//// int outputColumn1 = 0, outputValueCount1 = 0;
|
|
|
//// char*** outputValue1 = NULL;
|
|
|
//// string gyId;
|
|
|
//// printf("search3 ===> %s\n", selectGyId);
|
|
|
////
|
|
|
//// QuerySQLNoInputParam(selectGyId, &outputColumn1, &outputValueCount1, &outputValue1);
|
|
|
//// for (int num = 0; num < outputValueCount1; num++) {
|
|
|
//// string gxbm = outputValue1[num][0];
|
|
|
//// string rgsj = outputValue1[num][1];
|
|
|
//// string jqsj = outputValue1[num][2];
|
|
|
//// if (jqsj.find_first_of(".") != std::string::npos) {
|
|
|
//// string a = "0";
|
|
|
//// jqsj = a.append(jqsj);
|
|
|
//// }
|
|
|
//// string zbsj = outputValue1[num][3];
|
|
|
//// string zrsczq = outputValue1[num][4];
|
|
|
//// TimeBean bean;
|
|
|
//// bean.rgsj = rgsj;
|
|
|
//// bean.jqsj = jqsj;
|
|
|
//// bean.zbsj = zbsj;
|
|
|
//// bean.zrsczq = zrsczq;
|
|
|
//// beanMap[gxbm] = bean;
|
|
|
//// }
|
|
|
//// //克隆出来的工艺路线
|
|
|
//// getGxbmMap(clone_tag, newProcessMap, beanMap);
|
|
|
//// map<string, tag_t>::iterator it;
|
|
|
//// for (it = tmpProcessMap.begin(); it != tmpProcessMap.end(); it++) {
|
|
|
//// string gxbm = it->first;
|
|
|
//// tag_t tmpGx = it->second;
|
|
|
//// if (newProcessMap.count(gxbm) != 0) {
|
|
|
//// tag_t* procGuidBooks, * processRules;
|
|
|
//// int cnt2 = 0, cnt3 = 0;
|
|
|
//// tag_t newGx = newProcessMap[gxbm];
|
|
|
//// ITKCALL(AOM_ask_value_tags(tmpGx, "ZT2_ProcGuidBookRelation", &cnt2, &procGuidBooks));
|
|
|
//// ITKCALL(AOM_ask_value_tags(tmpGx, "ZT2_ProcessRuleRelation", &cnt3, &processRules));
|
|
|
//// AOM_lock(newGx);
|
|
|
//// if (cnt2 > 0) {
|
|
|
//// ITKCALL(AOM_set_value_tags(newGx, "ZT2_ProcGuidBookRelation", cnt2, procGuidBooks));
|
|
|
//// }
|
|
|
//// if (cnt3 > 0) {
|
|
|
//// ITKCALL(AOM_set_value_tags(newGx, "ZT2_ProcessRuleRelation", cnt3, processRules));
|
|
|
//// }
|
|
|
//// AOM_save(newGx);
|
|
|
//// AOM_unlock(newGx);
|
|
|
//// }
|
|
|
//// }
|
|
|
//// //}
|
|
|
//// return clone_tag;
|
|
|
////}
|
|
|
//////实体且有BOM往下
|
|
|
////boolean isXn(tag_t matnr) {
|
|
|
//// int cnt2, numFac, cnt3;
|
|
|
//// boolean flag = false;
|
|
|
//// char** procureType, ** factorys, ** specialProcureType;
|
|
|
//// AOM_ask_value_strings(matnr, "zt2_SZSpecialProcuretype", &cnt3, &specialProcureType); //为/
|
|
|
//// AOM_ask_value_strings(matnr, "zt2_SZProcuretype", &cnt2, &procureType); //包含自制
|
|
|
//// AOM_ask_value_strings(matnr, "zt2_SZFactory", &numFac, &factorys);
|
|
|
//// for (int i = 0; i < numFac; i++) {
|
|
|
//// if (strcmp(factorys[i], "M060") == 0 && cnt2 > i && cnt3 > i) {
|
|
|
//// if (strstr(procureType[i], "自制") != NULL && strcmp(specialProcureType[i], "/") == 0) {
|
|
|
//// flag = true;
|
|
|
//// }
|
|
|
//// }
|
|
|
//// }
|
|
|
//// return flag;
|
|
|
////}
|
|
|
//////获取分类属性 判断是否整除
|
|
|
////string getClassVal(tag_t top_rev_tag, string& errMessage,ByqBean &bean) {
|
|
|
//// //, string className
|
|
|
//// tag_t top_classificationObject;
|
|
|
//// ICS_ask_classification_object(top_rev_tag, &top_classificationObject);
|
|
|
//// if (top_classificationObject == NULL_TAG)
|
|
|
//// {
|
|
|
//// printf("顶层对象没有发送到分类\n");
|
|
|
//// return "";
|
|
|
//// }
|
|
|
//// char* top_class_id = NULL, * top_class_name = NULL;
|
|
|
//// //ICS_ask_class_of_classification_obj(top_classificationObject, &top_class_tag);
|
|
|
//// //ICS_ask_id_name(top_class_tag, &top_class_id, &top_class_name);
|
|
|
//// printf("BOM TOP LINE CLASS ID = %s | NAME = %s \n", top_class_id, top_class_name);
|
|
|
//// int n_attrs;
|
|
|
//// char** attr_names;
|
|
|
//// char** attr_vals;
|
|
|
//// ITKCALL(ICS_ask_attributes_of_classification_obj(top_classificationObject, &n_attrs, &attr_names, &attr_vals));
|
|
|
//// cout << n_attrs << endl;
|
|
|
//// // int num = 1;
|
|
|
//// string cpxh;
|
|
|
//// for (int ii = 0; ii < n_attrs; ii++)
|
|
|
//// {
|
|
|
//// if (strcmp(attr_names[ii], "产品型号") == 0) {
|
|
|
//// if (strcmp(attr_vals[ii], "") == 0) {
|
|
|
//// errMessage.append("分类属性产品型号为空,请检查。\n");
|
|
|
//// return "";
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// cpxh = (attr_vals[ii]);
|
|
|
//// }
|
|
|
//// //break;
|
|
|
//// }else if (strcmp(attr_names[ii], "低压线圈绕线方式") == 0) {
|
|
|
//// if (strcmp(attr_vals[ii], "") == 0) {
|
|
|
//// errMessage.append("分类属性低压线圈绕线方式为空,请检查。\n");
|
|
|
//// return "";
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// bean.dyxq = attr_vals[ii];//cpxh = (attr_vals[ii]);
|
|
|
//// }
|
|
|
//// //break;
|
|
|
//// }
|
|
|
//// else if (strcmp(attr_names[ii], "中压线圈绕线方式") == 0) {
|
|
|
//// if (strcmp(attr_vals[ii], "") == 0) {
|
|
|
//// errMessage.append("分类属性中压线圈绕线方式为空,请检查。\n");
|
|
|
//// return "";
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// bean.zyxq = attr_vals[ii];//cpxh = (attr_vals[ii]);
|
|
|
//// }
|
|
|
//// //break;
|
|
|
//// }
|
|
|
//// else if (strcmp(attr_names[ii], "高压线圈绕线方式") == 0) {
|
|
|
//// if (strcmp(attr_vals[ii], "") == 0) {
|
|
|
//// errMessage.append("分类属性高压线圈绕线方式为空,请检查。\n");
|
|
|
//// return "";
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// bean.gyxq = attr_vals[ii];//cpxh = (attr_vals[ii]);
|
|
|
//// }
|
|
|
//// //break;
|
|
|
//// }
|
|
|
//// else if (strcmp(attr_names[ii], "调压线圈绕线方式") == 0) {
|
|
|
//// if (strcmp(attr_vals[ii], "") == 0) {
|
|
|
//// errMessage.append("分类属性调压线圈绕线方式为空,请检查。\n");
|
|
|
//// return "";
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// bean.tyxq = attr_vals[ii];//cpxh = (attr_vals[ii]);
|
|
|
//// }
|
|
|
//// //break;
|
|
|
//// }
|
|
|
//// else if (strcmp(attr_names[ii], "稳压线圈绕线方式") == 0) {
|
|
|
//// if (strcmp(attr_vals[ii], "") == 0) {
|
|
|
//// errMessage.append("分类属性稳压线圈绕线方式为空,请检查。\n");
|
|
|
//// return "";
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// bean.wyxq = attr_vals[ii];//cpxh = (attr_vals[ii]);
|
|
|
//// }
|
|
|
//// //break;
|
|
|
//// }
|
|
|
//// //五柱铁心
|
|
|
//// cout << attr_names[ii] << "\t"
|
|
|
//// << attr_vals[ii] << endl;
|
|
|
//// }
|
|
|
//// return cpxh;
|
|
|
////}
|
|
|
//////包含线圈
|
|
|
////
|
|
|
//////不包含线圈
|
|
|
////void Split2(string strArg, string spliter, vector<string>& ans)
|
|
|
////{
|
|
|
//// ans.clear();
|
|
|
//// size_t index0 = 0;
|
|
|
//// string one_arg;
|
|
|
//// if (strArg.find_first_not_of(' ') == string::npos)
|
|
|
//// strArg = "";
|
|
|
//// while (strArg.size() > 0)
|
|
|
//// {
|
|
|
//// index0 = strArg.find_first_of(spliter);
|
|
|
//// if (index0 != string::npos)
|
|
|
//// {
|
|
|
//// one_arg = strArg.substr(0, index0);
|
|
|
//// strArg = strArg.substr(index0 + 1);
|
|
|
//// ans.push_back(one_arg);
|
|
|
//// }
|
|
|
//// else
|
|
|
//// {
|
|
|
//// ans.push_back(strArg);
|
|
|
//// break;
|
|
|
//// }
|
|
|
//// }
|
|
|
////}
|
|
|
////tag_t getTmpProcess(string cpxh, string th, string& errBuff, string& oldGyId,boolean isXq, string xqfs) {
|
|
|
//// char selectCPZ[200], selectGyId[200];
|
|
|
//// sprintf(selectCPZ, sqlCpxh.c_str(), cpxh.c_str());
|
|
|
//// int outputColumn = 0, outputValueCount = 0;
|
|
|
//// char*** outputValue = NULL;
|
|
|
//// string productZu;
|
|
|
//// printf("search1\n");
|
|
|
//// QuerySQLNoInputParam(selectCPZ, &outputColumn, &outputValueCount, &outputValue);
|
|
|
//// printf("search11\n");
|
|
|
//// if (outputValueCount == 0) {
|
|
|
//// errBuff.append("当前变压器产品型号在数据库表中无对应典型产品族值,请联系管理员维护.\n");
|
|
|
//// return NULLTAG;
|
|
|
//// }
|
|
|
//// for (int j = 0; j < outputValueCount; j++) {
|
|
|
//// productZu = outputValue[j][0];
|
|
|
//// printf("productZu===>%s\n", productZu.c_str());
|
|
|
//// }
|
|
|
////
|
|
|
//// sprintf(selectGyId, sqlGyRule.c_str(), productZu.c_str(), th.c_str());
|
|
|
////
|
|
|
//// int outputColumn1 = 0, outputValueCount1 = 0;
|
|
|
//// char*** outputValue1 = NULL;
|
|
|
//// string gyId;
|
|
|
//// printf("search2 %s \n", selectGyId);
|
|
|
//// QuerySQLNoInputParam(selectGyId, &outputColumn1, &outputValueCount1, &outputValue1);
|
|
|
//// if (outputValueCount1 == 0) {
|
|
|
//// errBuff.append("图号:").append(th).append("无对应工艺模板ID,请维护后再指派工艺路线.\n");
|
|
|
//// return NULLTAG;
|
|
|
//// }
|
|
|
//// printf("search22\n");
|
|
|
//// for (int j = 0; j < outputValueCount1; j++) {
|
|
|
//// gyId = outputValue1[j][0];
|
|
|
//// printf("gyId===>%s\n", gyId.c_str());
|
|
|
//// }
|
|
|
//// oldGyId = gyId;
|
|
|
//// tag_t clone_tag = clone_process_from_template((char*)gyId.c_str(), isXq, productZu, xqfs);
|
|
|
//// printf("克隆完成===>\n");
|
|
|
//// return clone_tag;
|
|
|
////}
|
|
|
////
|
|
|
////void readProcessBom(tag_t bom_line, string& errorBuff) {
|
|
|
////
|
|
|
//// int c_line_count;
|
|
|
//// tag_t mantr, * c_line_tags;
|
|
|
//// ITKCALL(AOM_ask_value_tag(bom_line, "bl_line_object", &mantr));
|
|
|
//// ITKCALL(BOM_line_ask_all_child_lines(bom_line, &c_line_count, &c_line_tags));
|
|
|
//// if (c_line_count > 0 && isXn(mantr)) {
|
|
|
//// printf("实体\n");
|
|
|
//// //检查是否有工艺路线
|
|
|
//// int n_references = 0;
|
|
|
//// int* levels = 0;
|
|
|
//// tag_t* references_tag = NULLTAG;
|
|
|
//// char** relation_type_name = NULL;
|
|
|
//// //通过引用关系查找到变更单
|
|
|
//// ITKCALL(WSOM_where_referenced(mantr, 1, &n_references, &levels, &references_tag, &relation_type_name));
|
|
|
//// boolean hasProcess = false;
|
|
|
//// for (int i = 0; i < n_references; i++)
|
|
|
//// {
|
|
|
//// char* refType;
|
|
|
//// tag_t refTag = references_tag[i];
|
|
|
//// AOM_ask_value_string(refTag, "object_type", &refType);
|
|
|
//// if (strcmp(refType, "MEProcessRevision") == 0) {
|
|
|
//// hasProcess = true;
|
|
|
//// break;
|
|
|
//// }
|
|
|
//// }
|
|
|
//// if (!hasProcess) {
|
|
|
//// char* bl_desc,* objName;
|
|
|
//// AOM_ask_value_string(mantr, "object_name", &objName);
|
|
|
//// if (strstr(objName,"总装图") != NULL) {
|
|
|
//// tag_t byqRev;
|
|
|
//// string tmpGyId;
|
|
|
//// AOM_ask_value_tag(mantr,"TC_Is_Represented_By",&byqRev);
|
|
|
//// ByqBean bean;
|
|
|
//// string cpxh = getClassVal(byqRev, errorBuff, bean);
|
|
|
//// printf("cpxh===>%s\n", cpxh.c_str());
|
|
|
//// tag_t processTag = NULLTAG;
|
|
|
//// if (strstr(objName, "线圈") == NULL) {
|
|
|
//// processTag = getTmpProcess(cpxh, "1ZDB300000P", errorBuff, tmpGyId, false,"");
|
|
|
//// if (processTag != NULLTAG) {
|
|
|
//// save_representation(processTag, mantr, "IMAN_METarget");
|
|
|
//// //线圈改属性
|
|
|
//// }
|
|
|
//// }
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// AOM_ask_value_string(bom_line, "bl_rev_object_desc", &bl_desc);
|
|
|
//// vector<string> descVec1;
|
|
|
//// Split2(bl_desc, " ", descVec1);
|
|
|
//// if (descVec1.size() > 1) {
|
|
|
//// string drawNos = descVec1[1];
|
|
|
//// vector<string> drawNoVec1;
|
|
|
//// Split2(drawNos, "-", drawNoVec1);
|
|
|
//// if (drawNoVec1.size() > 1) {
|
|
|
//// string wordNo = drawNoVec1[1]; //工程号 拼接1ZDB300000P 查找分类属性
|
|
|
//// string drawNo = drawNoVec1[0]; //图号
|
|
|
//// /*vector<string> vec2;
|
|
|
//// Split2(drawNo,"_", vec2);
|
|
|
//// if (vec2.size() > 1) {
|
|
|
//// drawNo = vec2[0];
|
|
|
//// }*/
|
|
|
//// string byqId = "1ZDB300000P-", tmpGyId;
|
|
|
//// tag_t byqTag, byqRev;
|
|
|
//// byqId.append(wordNo);
|
|
|
//// ITKCALL(ITEM_find_item(byqId.c_str(), &byqTag));
|
|
|
//// ITKCALL(ITEM_ask_latest_rev(byqTag, &byqRev));
|
|
|
//// ByqBean bean;
|
|
|
//// string cpxh = getClassVal(byqRev, errorBuff,bean);
|
|
|
//// printf("cpxh===>%s\n", cpxh.c_str());
|
|
|
//// tag_t processTag = NULLTAG;
|
|
|
//// if (strstr(objName, "线圈") == NULL) {
|
|
|
//// processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, false, "");
|
|
|
//// if (processTag != NULLTAG) {
|
|
|
//// save_representation(processTag, mantr, "IMAN_METarget");
|
|
|
//// }
|
|
|
//// }
|
|
|
//// else {
|
|
|
//// string xqfs;
|
|
|
//// if (strstr(objName, "低压线圈")!=NULL) {
|
|
|
//// //当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
//// if (bean.dyxq.empty()) {
|
|
|
//// errorBuff.append("当前低压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
//// return;
|
|
|
//// }
|
|
|
//// xqfs = bean.dyxq;
|
|
|
//// }else if(strstr(objName, "中压线圈") != NULL) {
|
|
|
//// //当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
//// if (bean.zyxq.empty()) {
|
|
|
//// errorBuff.append("当前中压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
//// return;
|
|
|
//// }
|
|
|
//// xqfs = bean.zyxq;
|
|
|
//// }
|
|
|
//// else if (strstr(objName, "高压线圈") != NULL) {
|
|
|
//// //当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
//// if (bean.gyxq.empty()) {
|
|
|
//// errorBuff.append("当前高压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
//// return;
|
|
|
//// }
|
|
|
//// xqfs = bean.gyxq;
|
|
|
//// }
|
|
|
//// else if (strstr(objName, "调压线圈") != NULL) {
|
|
|
//// //当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
//// if (bean.tyxq.empty()) {
|
|
|
//// errorBuff.append("当前调压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
//// return;
|
|
|
//// }
|
|
|
//// xqfs = bean.tyxq;
|
|
|
//// }
|
|
|
//// else if (strstr(objName, "稳压线圈") != NULL) {
|
|
|
//// //当前XXX线圈未在变压器参数表中维护绕线方式分类属性,请前往维护
|
|
|
//// if (bean.wyxq.empty()) {
|
|
|
//// errorBuff.append("当前稳压线圈未在变压器参数表中维护绕线方式分类属性,请前往维护\n");
|
|
|
//// return;
|
|
|
//// }
|
|
|
//// xqfs = bean.wyxq;
|
|
|
//// }
|
|
|
//// processTag = getTmpProcess(cpxh, drawNo, errorBuff, tmpGyId, true, xqfs);
|
|
|
//// if (processTag != NULLTAG) {
|
|
|
//// save_representation(processTag, mantr, "IMAN_METarget");
|
|
|
//// }
|
|
|
//// }
|
|
|
//// }
|
|
|
//// }
|
|
|
//// }
|
|
|
//// }
|
|
|
//// }
|
|
|
//// for (int i = 0; i < c_line_count; i++) {
|
|
|
//// tag_t c_line_tag = c_line_tags[i];
|
|
|
//// readProcessBom(c_line_tag, errorBuff);
|
|
|
//// }
|
|
|
////}
|
|
|
////
|
|
|
////void cloneProcess(char * revUid) {
|
|
|
////
|
|
|
//// int ifail = ITK_ok;
|
|
|
//// char* sql = NULL;
|
|
|
//// tag_t designRev;
|
|
|
//// //ITKCALL(ifail = USERARG_get_string_argument(&revUid));
|
|
|
//// ITK__convert_uid_to_tag(revUid, &designRev);
|
|
|
//// int bvr_count = 0, c_line_count;
|
|
|
//// tag_t ebom_window = NULLTAG;
|
|
|
//// tag_t bom_line = NULLTAG;
|
|
|
//// tag_t item_tag = NULLTAG, * c_line_tags;
|
|
|
//// (BOM_create_window(&ebom_window));
|
|
|
//// tag_t* bvr_list = NULL;
|
|
|
//// (ITEM_rev_list_bom_view_revs(designRev, &bvr_count, &bvr_list));
|
|
|
//// printf("bvr_count=%d", bvr_count);
|
|
|
////
|
|
|
//// (BOM_set_window_top_line_bvr(ebom_window, bvr_list[0], &bom_line)); //顶层bom获取
|
|
|
////
|
|
|
//// int url_num = 0;
|
|
|
//// char** url_vals = NULL;
|
|
|
//// PREF_ask_char_values("database_tc", &url_num, &url_vals);
|
|
|
//// string url = url_vals[0];
|
|
|
//// url.append("/").append(url_vals[2]);
|
|
|
//// string errorBuff;
|
|
|
//// //map<string,
|
|
|
//// printf("url ==> %s \n", url.c_str());
|
|
|
//// if (ConnServer(url_vals[3], url_vals[4], (char*)url.c_str()) == -1)
|
|
|
//// {
|
|
|
//// printf("提示:中间数据表访问失败\n");
|
|
|
//// ifail = 1;
|
|
|
//// }
|
|
|
////
|
|
|
//// readProcessBom(bom_line, errorBuff);
|
|
|
//// DisConnServer();
|
|
|
////
|
|
|
//// printf("errorBuff==>%s\n", errorBuff.c_str());
|
|
|
//// BOM_close_window(ebom_window);
|
|
|
////
|
|
|
////}
|