WIP_ENTITIES.ENTITY_TYPE

WIP_ENTITIES.ENTITY_TYPE

Value Meaning
1Discrete job
2Repetitive assembly
3Closed discrete job
4Flow schedule

优化sql:SELECT we.organization_id ,we.wip_entity_id ,case when wl.line_id is null then we.wip_entity_name else '' end wip_entity_name ,we.primary_item_id ,mtt.transaction_type_name ,mmt.transaction_date ,bd.department_code ,mmt.inventory_item_id ,mmt.subinventory_code ,mta.reference_account ,br.resource_code ,lu2.meaning as line_type_name ,mta.base_transaction_value ,mta.cost_element_id ,flv.meaning as cost_element ,wdj.class_code job_type_code ,ml.meaning job_type_name FROM (select * from gerp.mtl_material_transactions where substr(transaction_date,1,7) >= '2023-06' and transaction_source_type_id = 5) mmt inner join gerp.wip_entities we on mmt.organization_id = we.organization_id inner join gerp.mtl_transaction_accounts mta on mta.transaction_source_id = we.wip_entity_id and mta.transaction_id = mmt.transaction_id and mta.transaction_source_type_id = 5 inner join gerp.mtl_transaction_types mtt on mtt.transaction_type_id = mmt.transaction_type_id inner join mfg_lookups lu2 on lu2.lookup_code = mta.accounting_line_type and lu2.lookup_type = 'CST_ACCOUNTING_LINE_TYPE' inner join gerp.mtl_system_items_b msi on msi.inventory_item_id = mmt.inventory_item_id and msi.organization_id = mta.organization_id left join gerp.bom_departments bd on bd.department_id = mmt.department_id left join gerp.bom_resources br on br.resource_id = mta.resource_id left join gerp.wip_lines wl on wl.line_id = mmt.repetitive_line_id left join gerp.wip_discrete_jobs wdj on wdj.wip_entity_id = mta.transaction_source_id left join gerp.fnd_lookup_values_vl flv on cast(mta.cost_element_id as string) = flv.lookup_code and flv.lookup_type = 'CST_COST_CODE_TYPE' left join mfg_lookups ml on ml.lookup_code = wdj.job_type and ml.lookup_type = 'WIP_DISCRETE_JOB' 。其中mmt,we,mta,msi,wdj数据量很大
06-10
private void txt_wip_KeyPress(object sender, KeyPressEventArgs e) { lbl_msg.Text = ""; if (e.KeyChar == 13) { //如果文本框内容为空或未输入 if (string.IsNullOrEmpty(txt_opname.Text)) { lbl_msg.Text = "確認輸入正確工號,顯示姓名"; } lastKeyPressTime = DateTime.Now;//刷wipsn時更新最新作業時間 2024年8月8日 string bluid = txt_wip.Text.Trim().ToUpper();//ToUpper()將字符串中所有字母字符轉換爲大寫形式 if (!Regex.IsMatch(bluid, ModelInfo.regex)) { lbl_msg.Text = $"{bluid}條碼不符合{ModelInfo.rmodel}規則"; txt_wip.Text = ""; return; } else { //判斷重複過站 for (int i = 0; i < listView1.Items.Count; i++) { if (listView1.Items[i].SubItems[0].Text == bluid) { lbl_msg.Text = "重複掃碼"; txt_wip.Text = ""; txt_wip.Focus(); return; } } //判斷防跳站 string check = wscommon.CheckRoute(bluid, _STATION, (int)ModelInfo.routeid); if (check != "OK") { txt_wip.Text = ""; txt_wip.Focus(); lbl_msg.Text = check; } else { txt_lgp.Text = ""; txt_lgp.Enabled = true; txt_lgp.Focus(); } } } } public string CheckRoute(string wipsn, string station, int routid) { var oldsn = wipsn; WSSNNew wssn = new WSSNNew(); oldsn = wssn.GetOldsnByNewsn(wipsn); string msg = "OK"; using (var db = new ncloud1Entities()) { #region 降低sql連接數 var result = db.NS_WIP_SN.Find(wipsn);//qiu.zhang 2024年6月21日 if (result == null) { result = db.NS_WIP_SN.Where(p => (p.blusn == wipsn)).FirstOrDefault(); } if (oldsn != wipsn) { result = db.NS_WIP_SN.Where(p => (p.wipsn == wipsn)).Union(db.NS_WIP_SN.Where(p => (p.wipsn == oldsn))).FirstOrDefault(); if (result == null) { result = db.NS_WIP_SN.Where(p => (p.blusn == wipsn)).Union(db.NS_WIP_SN.Where(p => (p.blusn == oldsn))).FirstOrDefault(); } } if (result != null && result.status == -1)//判斷status,正常則繼續執行,非正常則彈出提醒並退出此方法 { return "條碼信息鎖定無法掃描: " + result.memo; } #endregion var route = db.NP_ROUTE_ITEM.Where(r => r.routeid == routid && r.station == station).FirstOrDefault(); if (route != null) { string[] fixs = string.IsNullOrEmpty(route.prefixs) ? new string[] { } : route.prefixs.Split(',');//固定前站,ALL表示全部 string[] checks = string.IsNullOrEmpty(route.prechecks) ? new string[] { } : route.prechecks.Split(','); //過站檢查 var wips = db.NS_WIP_DATA.Where(w => (w.bluid == wipsn)).ToList(); if (oldsn != wipsn) { wips = db.NS_WIP_DATA.Where(w => (w.bluid == wipsn)).Union(db.NS_WIP_DATA.Where(w => (w.bluid == oldsn))).ToList(); } var dic = db.NP_STATION_LIST.ToDictionary(d => d.code); if (fixs.Length > 0 && !fixs.Contains("ALL")) { var lastwip = wips.OrderBy(d => d.ctime).LastOrDefault(); if (lastwip != null) { if (!fixs.Contains(lastwip.station)) { msg = $"前序工站錯誤,最後工站{ lastwip.station }({dic[lastwip.station].name})"; return msg; } } else { msg = $"無過站記錄"; return msg; } } if (checks.Length > 0) { foreach (var item in checks) { var lastwip = wips.Where(w => w.station == item).OrderBy(d => d.ctime).LastOrDefault(); if (lastwip != null) { if (lastwip.pass == false) { msg = $"工站{ item }({dic[item].name})未通過"; return msg; } } else { msg = $"沒有{ item }({dic[item].name})過站記錄"; return msg; } } } } } return msg; } public string GetOldsnByNewsn(string sn) { var new_sn = sn; if (sn.StartsWith("DY9") && sn.Substring(7, 1) == "A")//A是補條碼的特征 { //根據新條碼獲取舊條碼 2025-04-01 using (var db = new ncloud1Entities()) { var logs = db.NS_SN_NEW.Where(s => s.newsn == sn && s.newsn != s.oldsn).FirstOrDefault();//換過的條碼不能再換,排除複製的標籤 new_sn = logs == null ? sn : logs.oldsn;//返回傳過來的sn或者舊條碼 } } return new_sn; }根據代碼描述數據和數據表的流向,用流程圖展示,中文
08-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值