斯末尔单品过站优化,增加自动开工功能,自动完工,华舟数采优化
1个文件已添加
31个文件已修改
5个文件已删除
580 ■■■■ 已修改文件
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/DBHelper.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm_HZ.cs 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV_New.Designer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV_New.cs 236 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm_New.cs 279 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.zip 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/三坐标Debug.zip 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/点胶称重Debug.zip 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/组装Debug.zip 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/镭雕Debug.zip 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.AssemblyReference.cache 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.FileListAbsolute.txt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb 补丁 | 查看 | 原始文档 | blame | 历史
WFormSynchronizeData_SMR/.vs/WFormSynchronizeData_SMR/v16/.suo
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/DBHelper.cs
@@ -216,6 +216,11 @@
                throw (e);
                return null;
            }
            finally
            {
                // å…³é”®ï¼šå¼ºåˆ¶é‡Šæ”¾ DataAdapter,解决连接泄漏
                dap.Dispose();
            }
        }
        /// <summary>
        /// æ‰§è¡ŒSQL并返回DATASET和错误信息
WFormSynchronizeData_SMR/EquipmentCollectionForm/EquipmentCollectionForm_HZ.cs
@@ -29,17 +29,18 @@
        private readonly object _collectingLock = new object();
        private DateTime _lastCollectionTime;
        private CancellationTokenSource _cts;
        private HttpClient _httpClient;
        private static HttpClient _httpClient;
        private readonly object _taskLock = new object();
        public EquipmentCollectionForm_HZ()
        {
            InitializeComponent();
            // åˆå§‹åŒ–HttpClient
            _httpClient = new HttpClient
            if (_httpClient == null)
            {
                Timeout = TimeSpan.FromSeconds(30)
            };
                _httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(30) };
            }
            // è®¾ç½®æœ€åŽé‡‡é›†æ—¶é—´æ–‡ä»¶è·¯å¾„
            _lastCollectTimeFile = Path.Combine(
@@ -118,14 +119,11 @@
        // ä¿®æ”¹åŽçš„定时获取数据方法 - å¼‚步优化版
        private async void timer_Tick(object sender, EventArgs e)
        {
            // é˜²æ­¢é‡å¤æ‰§è¡Œ
            lock (_collectingLock)
            lock (_taskLock)
            {
                if (_isCollecting)
                {
                    CustomWriteLog("上次采集仍在进行中,跳过本次采集", DateTime.Now.ToString("yyyy-MM-dd"));
                    return;
                }
                if (_isCollecting) return;
                _isCollecting = true;
            }
@@ -994,6 +992,12 @@
        //定时生成产量汇报单 - ä¿æŒä¸å˜
        private async void Time_CLHB_Tick(object sender, EventArgs e)
        {
            if (!Monitor.TryEnter(_taskLock, 1000))
            {
                CustomWriteLog("采集正在执行,跳过本次产量汇报", DateTime.Now.ToString("yyyy-MM-dd"));
                return;
            }
            try
            {
                CustomWriteLog("=== å¼€å§‹æ‰§è¡Œäº§é‡æ±‡æŠ¥å•定时任务 ===", DateTime.Now.ToString("yyyy-MM-dd"));
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.exe
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/bin/Debug/EquipmentCollectionForm.pdb
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.exe
Binary files differ
WFormSynchronizeData_SMR/EquipmentCollectionForm/obj/Debug/EquipmentCollectionForm.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV_New.Designer.cs
@@ -209,7 +209,7 @@
            this.Controls.Add(this.label2);
            this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
            this.Name = "ReadCSV_New";
            this.Text = "ReadCSV";
            this.Text = "ReadCSV_NEW";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ReadCSV_FormClosing);
            this.ResumeLayout(false);
            this.PerformLayout();
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadCSV_New.cs
@@ -20,6 +20,21 @@
        private List<CodeNameItem> empHistoryList = new List<CodeNameItem>();
        private List<CodeNameItem> sourceHistoryList = new List<CodeNameItem>();
        public static int num = 0;
        public static DateTime time = DateTime.Now.AddMinutes(-5);
        public static string AllProcessExchange = "-1";
        public static string AllProcessExchangeHProcExchBillNo = "";
        public static string AllProcessExchangeHProcExchInterID = "";
        public static string AllSNBarcodeProcCtrl = "";
        public static string AllHProcID = "0";
        public static string AllHProName = "";
        public static double AllHQty = 0;
        public static string AllBeginWork = "-1";
        public static Dictionary<string, double> RemainingQtyCache = new Dictionary<string, double>();  // ç¼“存每个流转卡+工序的剩余数量
        public static Dictionary<string, DateTime> CacheUpdateTime = new Dictionary<string, DateTime>(); // è®°å½•每次缓存更新的时间,用于判断是否需要刷新
        public string CurrentActiveKey = "";//缓存键,用于判断流转卡是否切换
        public ReadCSV_New()
        {
            InitializeComponent();
@@ -105,8 +120,7 @@
            }
        }
        public static int num = 0;
        public static DateTime time = DateTime.Now.AddMinutes(-5);
        //组装工序CSV è¿‡ç«™è¯»å– æ–°çš„
@@ -381,6 +395,8 @@
                        DateTime NowTime = DateTime.Parse(item["测试时间"].ToString());
                        string HBadCodeSN = item["序号"].ToString();
                        if (((NowTime >= ActionTime && NowTime < EndTime) || dt.Rows.Count <= 20) && HBadCodeSN != "" && list.Contains(HBadCodeSN) == false)
                        {
@@ -398,7 +414,7 @@
                                string HType = "";
                                int HCount = 1;
                                DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN with(nolock) where HBarCode='" + HBarCode + "' and HProcNumber='" + HProcNumber + "'", "Sb_EquipMentCollection_SN");
                                DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN with(nolock) where HBarCode='" + HBarCode + "' and HProcNumber='" + HProcNumber + "'", "Sb_EquipMentCollection_SN");
                                if (ds.Tables[0].Rows.Count == 0)
                                {
                                    if (Get_AllowLoadData(HBarCode, HProcNumber, flag_1, out flag_2))
@@ -424,7 +440,7 @@
                                                {
                                                    string sql1 = $@"insert into Sb_EquipMentCollectionTechParam_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
                                                    values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount_1}','{HCreateTime}',GETDATE(),'{HResult}','{HProcNumber}','{HFlag}')";
                                                    oCN.RunProc(sql1);
                                                    oCN.RunProc(sql1);
                                                }
                                            }
                                        }
@@ -516,16 +532,7 @@
            }
        }
        public static string AllProcessExchange = "-1";
        public static string AllProcessExchangeHProcExchBillNo = "";
        public static string AllProcessExchangeHProcExchInterID = "";
        public static string AllSNBarcodeProcCtrl = "";
        public static string AllHProcID = "0";
        public static string AllHProName = "";
        public static double AllHQty = 0;
        public static Dictionary<string, double> RemainingQtyCache = new Dictionary<string, double>();  // ç¼“存每个流转卡+工序的剩余数量
        public static Dictionary<string, DateTime> CacheUpdateTime = new Dictionary<string, DateTime>(); // è®°å½•每次缓存更新的时间,用于判断是否需要刷新
        public string CurrentActiveKey = "";//缓存键,用于判断流转卡是否切换
        //根据条码 åˆ¤æ–­æ˜¯å¦ä¿å­˜
        public bool Get_AllowLoadData(string HBarCode, string HProcNumber, bool flag_1, out bool flag_2)
        {
@@ -535,7 +542,6 @@
                flag_2 = false;
                return false;
            }
            //判断长度是否为29位 æ— å°˜è½¦é—´
            string HProcExchBillNo = "";
            string HProcExchInterID = "";
@@ -609,7 +615,22 @@
                    AllHProcID = ds1.Tables[0].Rows[0]["HItemID"].ToString();
                    AllHProName = ds1.Tables[0].Rows[0]["HName"].ToString();
                }
                //判断当前流转卡对应的工序数据是否开工
                ds1 = oCN.RunProcReturn("select  * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + AllProcessExchangeHProcExchBillNo + "' and HProcID='" + AllHProcID + "'", "Sc_ICMOBillStatus_Tmp");
                if (ds1.Tables[0].Rows.Count > 0)
                {
                    //生产状态临时表  çŠ¶æ€å¦‚æžœä¸º0 é‚£å°±æ˜¯æ²¡å¼€å·¥ è¿›å…¥å¼€å·¥å•
                    if (ds1.Tables[0].Rows[0]["HICMOStatus"].ToString() == "0")
                    {
                        bool completeFlag = SaveMESBeginWorkFrom_ZD(ds1.Tables[0].Rows[0]["HBillType"].ToString(), ds1.Tables[0].Rows[0]["HInterID"].ToString(), ds1.Tables[0].Rows[0]["HSourceEntryID"].ToString(), ds1.Tables[0].Rows[0]["HSourceBillNo"].ToString(), this.HEmpCodeName.Text, ds1.Tables[0].Rows[0]["HSourceBillType"].ToString());
                        if (!completeFlag)
                        {
                            MessageBox.Show(new Form { TopMost = true }, "流转卡:" + AllProcessExchangeHProcExchBillNo + ",自动生成开工单失败!");
                        }
                    }
                }
                //查询流转卡数量
                ds1 = oCN.RunProcReturn(@"SELECT  HQty FROM Sc_ProcessExchangeBillSub WITH(NOLOCK)   where HInterID=" + HProcExchInterID + " and HProcID=" + AllHProcID, "Sc_ProcessExchangeBillSub");
                if (ds1.Tables[0].Rows.Count > 0)
@@ -622,9 +643,7 @@
            string HProcID = AllHProcID;
            string HProName = AllHProName;
            ////第一次流转卡+工序和后面的做对比 å¦‚果是同一个流转卡就不进行判断
            //if ((HProcExchBillNo + HProcNumber) == AllSNBarcodeProcCtrl)
            //{
            //判断 å½“前工序 æ¡ç  çš„上一道工序有没有过站
            ds1 = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S_New '" + HBarCode + "'," + HProcID, "h_p_Sc_SNBarcodeProcCtrl_S_New");
@@ -654,7 +673,6 @@
                flag_2 = true;
                return false;
            }
            //}
            // æŸ¥è¯¢å‡ºç«™æ•°é‡æ˜¯å¦è¶…过流转卡数量
@@ -753,6 +771,184 @@
            return true;
        }
        //自动开工
        public bool SaveMESBeginWorkFrom_ZD(string HBillType, string HSourceInterID, string HSourceEntryID, string HSourceBillNo, string user, string HSourceBillType)
        {
            try
            {
                DataSet ds;
                ds = oCN.RunProcReturn("exec h_p_JIT_GetInfoByICMOStatusInterID @HSourceInterID='" + HSourceInterID + "',@HSourceEntryID='" + HSourceEntryID + "',@HSourceBillNo='" + HSourceBillNo + "',@HSourceBillType='" + HBillType + "'", "h_p_JIT_GetInfoByICMOStatusInterID");
                string sExeReturnInfo = "";
                long HProcID = int.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString());
                long HMaterID = int.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString());
                long HSourceID = int.Parse(ds.Tables[0].Rows[0]["HSourceID"].ToString());
                string HMainSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
                long HMainSourceInterID = int.Parse(ds.Tables[0].Rows[0]["HSourceInterID"].ToString());
                long HMainSourceEntryID = long.Parse(ds.Tables[0].Rows[0]["HSourceEntryID"].ToString());
                string HMainSourceBillType = HSourceBillType == null ? "" : HSourceBillType;
                long HDeptID = int.Parse(ds.Tables[0].Rows[0]["HDeptID"].ToString());
                long HICMOInterID = int.Parse(ds.Tables[0].Rows[0]["HICMOInterID"].ToString());
                long HICMOEntryID = int.Parse(ds.Tables[0].Rows[0]["HICMOEntryID"].ToString());
                string HICMOBillNo = ds.Tables[0].Rows[0]["HICMOBillNo"].ToString();
                long HProcExchInterID = int.Parse(ds.Tables[0].Rows[0]["HProcExchInterID"].ToString());
                long HProcExchEntryID = int.Parse(ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString());
                string HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString();
                long HWorkShiftID = 0;
                //获取班次
                DataSet set = oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo '389505','77'", "h_p_Gy_GetWorkShiftInfo");
                if (set.Tables[0].Rows.Count > 0)
                {
                    HWorkShiftID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString());
                }
                ds = oCN.RunProcReturn("select * from Gy_Employee  where HNumber='" + this.HEmpCode.Text + "'", "Gy_Employee");
                long HGroupID = int.Parse(ds.Tables[0].Rows[0]["HGroupID"].ToString());
                long HEmpID = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());
                Int64 HInterID = CreateBillID("3787", ref sExeReturnInfo);
                string HBillNo = CreateBillCode_Prod("3787", ref sExeReturnInfo, true);
                //保存前
                ds = oCN.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_BeforeSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + 1, "h_p_Sc_MESEndWorkBill_BeforeSaveCtrl");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                oCN.RunProc("Insert Into Sc_MESBeginWorkBillMain " +
              "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
              ",HYear,HPeriod,HRemark" +
              ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
              ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HBeginWorkTime,HSourceID" +
              ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
              ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" +
              ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
              ",HRunStatus,HSourceBeginQty,HWorkShiftID,HPeopleSum" +
              ") " +
              " values('3787','3787'," + HInterID + ",'" + HBillNo + "',1,getdate(),'" + user + "',getdate()" +
              ",Year(getdate()),Month(getdate()),'自动开工'" +
              "," + HICMOInterID + ",'" + HICMOEntryID + "','" + HICMOBillNo + "',0,0,''," + HProcExchInterID + "," + HProcExchEntryID +
              ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + ",0,0,getdate()," + HSourceID +
              "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'','','',getdate()" +
              "," + HMainSourceInterID + "," + HMainSourceEntryID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'" +
              "," + HMainSourceInterID + "," + HMainSourceEntryID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'" +
              ",0,0,'" + HWorkShiftID + "',1) ");
                oCN.RunProc(" Update Sc_MESBeginWorkBillMain set HBillStatus='2',HChecker='" + user + "',HCheckDate=getdate()  Where HInterID=" + HInterID.ToString());
                //根据开工单内码 å–到生产状态临时表主内码,然后更新生产状态临时表状态为:待生产  ä»»åŠ¡å•çŠ¶æ€(0待生产,1生产中,2挂起,3已完工)
                oCN.RunProc("exec h_p_JIT_MESBeginWorkBill_BeginWork @HInterId=" + HInterID + ",@flag='开工'");
                //保存后
                ds = oCN.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_AfterSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + 1, "h_p_Sc_MESBeginWorkBill_AfterSaveCtrl");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
        #region èŽ·å– å†…码  å•据号
        public static Int64 CreateBillID(string BillCode, ref string sReturn)
        {
            string BillType = "";
            DataSet Ds;
            DBHelper oCn = new DBHelper();
            Int64 lID;
            Ds = oCn.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + BillCode.Trim() + "'", "Gy_BillNumber");
            if (Ds.Tables[0].Rows.Count != 0)
            {
                lID = isLong(Ds.Tables[0].Rows[0]["IDNow"].ToString());
                BillType = Ds.Tables[0].Rows[0]["BillType"].ToString().Trim();
            }
            else
            {
                lID = 0;
            }
            //同类型单据 è‡ªå¢ž1
            if (BillType.Trim() != "")
            {
                oCn.RunProc("update Gy_BillNumber set IDNow=IDNow+1 where BillType='" + BillType.Trim() + "'");
            }
            oCn.CnClose();
            oCn.CnDispose();
            oCn = null;
            Ds = null;
            return lID;
        }
        public static string CreateBillCode_Prod(string BillCode, ref string sReturn, bool Add)
        {
            try
            {
                string BillType = "";
                DataSet Ds;
                DBHelper oCn = new DBHelper();
                string sBIllNO;
                Ds = oCn.RunProcReturn("exec h_p_Xt_GetMaxBillNo '" + BillCode + "'", "h_p_Xt_GetMaxBillNo");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sBIllNO = "ERROR";
                }
                else
                {
                    sBIllNO = isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                }
                oCn.CnClose();
                oCn.CnDispose();
                oCn = null;
                Ds = null;
                return sBIllNO;
            }
            catch (Exception e)
            {
                return "ERROR";
            }
        }
        #endregion
        #region è¾…助方法
        //判断是否是INT64
        public static Int64 isLong(object message)
        {
            try
            {
                return Convert.ToInt64(message);
            }
            catch (Exception e)
            {
                return 0;
            }
        }
        //判断是否NULL
        public static string isStrNull(object message)
        {
            try
            {
                if (message == null)
                {
                    return "";
                }
                else
                {
                    return message.ToString().Trim();
                }
            }
            catch (Exception e)
            {
                return "";
            }
        }
        #endregion
        //关闭
        private void ReadCSV_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (num == 1)
@@ -776,4 +972,4 @@
                HistoryConfigHelper.SaveSources(sourceHistoryList, lastSrcCode);
        }
    }
}
}
WFormSynchronizeData_SMR/WFormReadData_SMR/ReadyDataForm_New.cs
@@ -113,6 +113,21 @@
        public static DateTime time = DateTime.Now.AddMinutes(-5);
        public static decimal hqty = 2;
        public static string AllBeginWork = "-1";  //是否开工
        public static string AllProcessExchange = "-1";   //流转卡项目号
        public static string AllProcessExchangeHProcExchBillNo = "";  //流转卡号
        public static string AllProcessExchangeHProcExchInterID = ""; //流转卡主码
        public static string AllSNBarcodeProcCtrl = "";  //流转卡+工序的拼写
        public static string AllHProcID = "0";           //工序id
        public static string AllHProName = "";           //工序名字
        public static double AllHQty = 0;               //默认流转卡数量 å¦‚果出站单有数据会更新成出站单数量
        public static Dictionary<string, double> RemainingQtyCache = new Dictionary<string, double>();  // ç¼“存每个流转卡+工序的剩余数量
        public static Dictionary<string, DateTime> CacheUpdateTime = new Dictionary<string, DateTime>(); // è®°å½•每次缓存更新的时间,用于判断是否需要刷新
        public string CurrentActiveKey = "";//缓存键,用于判断流转卡是否切换
        // æ–°å¢žé™æ€å˜é‡ï¼šè®°å½•每个项目号的开工状态
public static Dictionary<string, bool> ProjectBeginWorkStatus = new Dictionary<string, bool>();
        //镭雕拍照工序文本 è¿‡ç«™è¯»å– æ–°çš„
        //读取数据
@@ -285,7 +300,7 @@
                {
                    stream = new StreamReader($@"D:\{year}\{month}\{day}\{dataTime}gy.txt", Encoding.GetEncoding("gb2312"));                    
                    FileData = stream.ReadToEnd();
                    //获取系统参数
                    //获取工艺参数
                    Xt_Gy_RoutBill(FileData);
                }
            }
@@ -293,11 +308,8 @@
       
        public static string AllBeginWork = "-1";  //是否开工
        public static string AllProcessExchange = "-1";   //流转卡项目号
        public static string AllProcessExchangeHProcExchBillNo = "";  //流转卡号
        public static string AllProcessExchangeHProcExchInterID = ""; //流转卡主码
        //读取文本条码
        public void Xt_ReadText(string FileData)
        {
            //获取文本所有数据
@@ -336,15 +348,14 @@
                    string HResult = list[i]["HResult"].ToString();
                    string HProcNumber = list[i]["HProcNumber"].ToString();
                    int HFlag = 0;
                    //DataSet ds = oCN.RunProcReturn(@"select * from Sb_EquipMentCollection_SN where HBarCode='" + HBarCode + "' and HCreateTime='" + HCreateTime + "'", "Sb_EquipMentCollection_SN");
                    if (true)
                    {
                        DataSet dataSet;
                        string HProjectNum = HBarCode.Substring(18, 8);
                        //通过截取项目号 å¦‚果第一条数据的项目号跟后面的一样 å°±ä¸è¿›è¡Œåˆ¤æ–­
                        if (HBarCode.Contains(AllProcessExchange) == false)
                        if (HProjectNum != AllProcessExchange)
                        {
                            //判断流转卡是否存在
@@ -360,17 +371,52 @@
                        if (AllProcessExchange == HProjectNum)
                        {
                            //通过截取项目号 å¦‚果第一条数据的项目号跟后面的一样 å°±ä¸è¿›è¡Œåˆ¤æ–­
                            if (HBarCode.Contains(AllBeginWork) == false)
                            //只判断第一个SN码是否进行开工,没有开工自动开工
                            if (HProjectNum != AllBeginWork)
                            {
                                //判断当前流转卡对应的工序数据是否开工
                                dataSet = oCN.RunProcReturn("select  HICMOStatus from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + AllProcessExchangeHProcExchBillNo + "' and HICMOStatus<>'0'", "Sc_ICMOBillStatus_Tmp");
                                // æŸ¥è¯¢å·¥åºä¿¡æ¯ï¼ˆä¸å˜ï¼‰
                                dataSet = oCN.RunProcReturn(@"SELECT  HItemID,HName FROM Gy_Process  WITH(NOLOCK) WHERE HNumber='" + HProcNumber + "'", "Gy_Process");
                                if (dataSet.Tables[0].Rows.Count > 0)
                                {
                                    AllBeginWork = HProjectNum;
                                    AllHProcID = dataSet.Tables[0].Rows[0]["HItemID"].ToString();
                                    AllHProName = dataSet.Tables[0].Rows[0]["HName"].ToString();
                                }
                                // æŸ¥è¯¢å¼€å·¥çŠ¶æ€è¡¨ï¼ˆä¸å˜ï¼‰
                                dataSet = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceBillNo='" + AllProcessExchangeHProcExchBillNo + "' and HProcID='" + AllHProcID + "'", "Sc_ICMOBillStatus_Tmp");
                                if (dataSet.Tables[0].Rows.Count > 0)
                                {
                                    // å…ˆè¯»å–状态,再判断赋值时机(核心修正)
                                    string hicmoStatus = dataSet.Tables[0].Rows[0]["HICMOStatus"].ToString();
                                    // æƒ…况1:状态=1(已开工)→ ç›´æŽ¥æ ‡è®°
                                    if (hicmoStatus == "1")
                                    {
                                        AllBeginWork = HProjectNum;
                                    }
                                    // æƒ…况2:状态=0(未开工)→ æ‰§è¡Œå¼€å·¥æ“ä½œï¼ŒæˆåŠŸæ‰æ ‡è®°
                                    else if (hicmoStatus == "0")
                                    {
                                        bool completeFlag = SaveMESBeginWorkFrom_ZD(dataSet.Tables[0].Rows[0]["HBillType"].ToString(), dataSet.Tables[0].Rows[0]["HInterID"].ToString(), dataSet.Tables[0].Rows[0]["HSourceEntryID"].ToString(), dataSet.Tables[0].Rows[0]["HSourceBillNo"].ToString(), this.HEmpCodeName.Text, dataSet.Tables[0].Rows[0]["HSourceBillType"].ToString());
                                        if (completeFlag)
                                        {
                                            // å¼€å·¥æˆåŠŸï¼Œæ‰æ ‡è®°ä¸ºå·²å¼€å·¥ï¼ˆä½ ç¡®è®¤æ­¤æ—¶çŠ¶æ€å·²æ›´1)
                                            AllBeginWork = HProjectNum;
                                        }
                                        else
                                        {
                                            // å¼€å·¥å¤±è´¥ï¼Œé‡ç½®ä¸º-1,避免误判
                                            AllBeginWork = "-1";
                                            MessageBox.Show("自动生成开工单失败!");
                                        }
                                    }
                                }
                                else
                                {
                                    // æ²¡æŸ¥åˆ°è®°å½• â†’ é‡ç½®ä¸º-1
                                    AllBeginWork = "-1";
                                }
                            }
                            //满足上述条件 å¹¶ä¸”项目号 å’Œèµ‹å€¼é¡¹ç›®å·ä¸€æ · åˆ™è¿›è¡Œæ–°å¢ž
                            if (AllBeginWork == HProjectNum)
                            {
@@ -424,7 +470,7 @@
            }
        }
        //读取系统参数
        //读取工艺参数
        public void Xt_Gy_RoutBill(string FileData)
        {
            FileData = FileData.Substring(0, FileData.Length - 1);
@@ -467,25 +513,17 @@
                    {
                        string sql = $@"insert into Sb_EquipMentCollectionTechParam_SN(HSourceCode,HEmpCode,HType,HBarCode,HCount,HCreateTime,HDate,HResult,HProcNumber,HFlag)
                        values('{HSourceCode}','{HEmpCode}','{HType}','{HBarCode}','{HCount}','{HCreateTime}',GETDATE(),'{HResult}','{HProcNumber}','{HFlag}')";
                        oCN.RunProc(sql);
                        //ListSelect.Items.Add("条码:" + HBarCode + ",日期:" + HCreateTime + ",结果:" + HResult);
                        oCN.RunProc(sql);
                    }
                }
                else
                {
                    //CustomWriteLog("时间不在保存范围内", DateTime.Now.ToString("yyyy-MM-dd"));
                }
            }
        }
        public static string AllSNBarcodeProcCtrl = "";  //流转卡+工序的拼写
        public static string AllHProcID = "0";           //工序id
        public static string AllHProName = "";           //工序名字
        public static double AllHQty = 0;               //默认流转卡数量 å¦‚果出站单有数据会更新成出站单数量
        public static Dictionary<string, double> RemainingQtyCache = new Dictionary<string, double>();  // ç¼“存每个流转卡+工序的剩余数量
        public static Dictionary<string, DateTime> CacheUpdateTime = new Dictionary<string, DateTime>(); // è®°å½•每次缓存更新的时间,用于判断是否需要刷新
        public string CurrentActiveKey = "";//缓存键,用于判断流转卡是否切换
        //根据条码 åˆ¤æ–­æ˜¯å¦ä¿å­˜
        public bool Get_AllowLoadData(string HBarCode, string HProcNumber, bool flag_1, string HProcExchBillNo, string HProcExchInterID, out bool flag_2)
        {
@@ -549,9 +587,6 @@
                AllSNBarcodeProcCtrl = HProcExchBillNo + HProcNumber;
            }
            ////第一次流转卡+工序和后面的做对比 å¦‚果是同一个流转卡就不进行判断
            //if ((HProcExchBillNo + HProcNumber) == AllSNBarcodeProcCtrl)
            //{
            //过站控制
            //判断当前工序对应的条码是否上道工序过站
            ds1 = oCN.RunProcReturn("exec h_p_Sc_SNBarcodeProcCtrl_S_New '" + HBarCode + "'," + AllHProcID, "h_p_Sc_SNBarcodeProcCtrl_S_New");
@@ -582,7 +617,6 @@
                flag_2 = true;
                return false;
            }
            //}
            // æŸ¥è¯¢å‡ºç«™æ•°é‡æ˜¯å¦è¶…过流转卡数量
@@ -680,7 +714,192 @@
            flag_2 = false;
            return true;
        }
        //自动开工
        public bool SaveMESBeginWorkFrom_ZD(string HBillType, string HSourceInterID, string HSourceEntryID, string HSourceBillNo, string user, string HSourceBillType)
        {
            try
            {
                DataSet ds;
                ds = oCN.RunProcReturn("exec h_p_JIT_GetInfoByICMOStatusInterID @HSourceInterID='" + HSourceInterID + "',@HSourceEntryID='" + HSourceEntryID + "',@HSourceBillNo='" + HSourceBillNo + "',@HSourceBillType='" + HBillType + "'", "h_p_JIT_GetInfoByICMOStatusInterID");
                string sExeReturnInfo = "";
                long HProcID = int.Parse(ds.Tables[0].Rows[0]["HProcID"].ToString());
                long HMaterID = int.Parse(ds.Tables[0].Rows[0]["HMaterID"].ToString());
                long HSourceID = int.Parse(ds.Tables[0].Rows[0]["HSourceID"].ToString());
                string HMainSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
                long HMainSourceInterID = int.Parse(ds.Tables[0].Rows[0]["HSourceInterID"].ToString());
                long HMainSourceEntryID = long.Parse(ds.Tables[0].Rows[0]["HSourceEntryID"].ToString());
                string HMainSourceBillType = HSourceBillType == null ? "" : HSourceBillType;
                long HDeptID = int.Parse(ds.Tables[0].Rows[0]["HDeptID"].ToString());
                long HICMOInterID = int.Parse(ds.Tables[0].Rows[0]["HICMOInterID"].ToString());
                long HICMOEntryID = int.Parse(ds.Tables[0].Rows[0]["HICMOEntryID"].ToString());
                string HICMOBillNo = ds.Tables[0].Rows[0]["HICMOBillNo"].ToString();
                long HProcExchInterID = int.Parse(ds.Tables[0].Rows[0]["HProcExchInterID"].ToString());
                long HProcExchEntryID = int.Parse(ds.Tables[0].Rows[0]["HProcExchEntryID"].ToString());
                string HProcExchBillNo = ds.Tables[0].Rows[0]["HProcExchBillNo"].ToString();
                long HWorkShiftID = 0;
                //获取班次
                DataSet set = oCN.RunProcReturn("exec h_p_Gy_GetWorkShiftInfo '389505','77'", "h_p_Gy_GetWorkShiftInfo");
                if (set.Tables[0].Rows.Count > 0)
                {
                    HWorkShiftID = int.Parse(set.Tables[0].Rows[0]["HInterID"].ToString());
                }
                ds = oCN.RunProcReturn("select * from Gy_Employee  with(nolock) where HNumber='" + this.HEmpCode.Text + "'", "Gy_Employee");
                long HGroupID = int.Parse(ds.Tables[0].Rows[0]["HGroupID"].ToString());
                long HEmpID = int.Parse(ds.Tables[0].Rows[0]["HItemID"].ToString());
                Int64 HInterID = CreateBillID("3787", ref sExeReturnInfo);
                string HBillNo = CreateBillCode_Prod("3787", ref sExeReturnInfo, true);
                //保存前
                ds = oCN.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_BeforeSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + 1, "h_p_Sc_MESEndWorkBill_BeforeSaveCtrl");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                oCN.RunProc("Insert Into Sc_MESBeginWorkBillMain " +
              "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
              ",HYear,HPeriod,HRemark" +
              ",HICMOInterID,HICMOEntryID,HICMOBillNo,HProcPlanInterID,HProcPlanEntryID,HProcPlanBillNo,HProcExchInterID,HProcExchEntryID" +
              ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HBeginWorkTime,HSourceID" +
              ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
              ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" +
              ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
              ",HRunStatus,HSourceBeginQty,HWorkShiftID,HPeopleSum" +
              ") " +
              " values('3787','3787'," + HInterID + ",'" + HBillNo + "',1,getdate(),'" + user + "',getdate()" +
              ",Year(getdate()),Month(getdate()),'自动开工'" +
              "," + HICMOInterID + ",'" + HICMOEntryID + "','" + HICMOBillNo + "',0,0,''," + HProcExchInterID + "," + HProcExchEntryID +
              ",'" + HProcExchBillNo + "'," + HMaterID + "," + HProcID + ",0,0,getdate()," + HSourceID +
              "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'','','',getdate()" +
              "," + HMainSourceInterID + "," + HMainSourceEntryID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'" +
              "," + HMainSourceInterID + "," + HMainSourceEntryID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'" +
              ",0,0,'" + HWorkShiftID + "',1) ");
                oCN.RunProc(" Update Sc_MESBeginWorkBillMain set HBillStatus='2',HChecker='" + user + "',HCheckDate=getdate()  Where HInterID=" + HInterID.ToString());
                //根据开工单内码 å–到生产状态临时表主内码,然后更新生产状态临时表状态为:待生产  ä»»åŠ¡å•çŠ¶æ€(0待生产,1生产中,2挂起,3已完工)
                oCN.RunProc("exec h_p_JIT_MESBeginWorkBill_BeginWork @HInterId=" + HInterID + ",@flag='开工'");
                //保存后
                ds = oCN.RunProcReturn("exec h_p_Sc_MESBeginWorkBill_AfterSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + 1, "h_p_Sc_MESBeginWorkBill_AfterSaveCtrl");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    return false;
                }
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
        #region èŽ·å– å†…码  å•据号
        public static Int64 CreateBillID(string BillCode, ref string sReturn)
        {
            string BillType = "";
            DataSet Ds;
            DBHelper oCn = new DBHelper();
            Int64 lID;
            Ds = oCn.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + BillCode.Trim() + "'", "Gy_BillNumber");
            if (Ds.Tables[0].Rows.Count != 0)
            {
                lID = isLong(Ds.Tables[0].Rows[0]["IDNow"].ToString());
                BillType = Ds.Tables[0].Rows[0]["BillType"].ToString().Trim();
            }
            else
            {
                lID = 0;
            }
            //同类型单据 è‡ªå¢ž1
            if (BillType.Trim() != "")
            {
                oCn.RunProc("update Gy_BillNumber set IDNow=IDNow+1 where BillType='" + BillType.Trim() + "'");
            }
            oCn.CnClose();
            oCn.CnDispose();
            oCn = null;
            Ds = null;
            return lID;
        }
        public static string CreateBillCode_Prod(string BillCode, ref string sReturn, bool Add)
        {
            try
            {
                string BillType = "";
                DataSet Ds;
                DBHelper oCn = new DBHelper();
                string sBIllNO;
                Ds = oCn.RunProcReturn("exec h_p_Xt_GetMaxBillNo '" + BillCode + "'", "h_p_Xt_GetMaxBillNo");
                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                {
                    sBIllNO = "ERROR";
                }
                else
                {
                    sBIllNO = isStrNull(Ds.Tables[0].Rows[0]["HBillNo"]);
                }
                oCn.CnClose();
                oCn.CnDispose();
                oCn = null;
                Ds = null;
                return sBIllNO;
            }
            catch (Exception e)
            {
                return "ERROR";
            }
        }
        #endregion
        #region è¾…助方法
        //判断是否是INT64
        public static Int64 isLong(object message)
        {
            try
            {
                return Convert.ToInt64(message);
            }
            catch (Exception e)
            {
                return 0;
            }
        }
        //判断是否NULL
        public static string isStrNull(object message)
        {
            try
            {
                if (message == null)
                {
                    return "";
                }
                else
                {
                    return message.ToString().Trim();
                }
            }
            catch (Exception e)
            {
                return "";
            }
        }
        #endregion
        //关闭
        private void ReadyDataForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (num == 1)
@@ -704,6 +923,8 @@
                HistoryConfigHelper.SaveSources(sourceHistoryList, lastSrcCode);
        }
        //检索补漏
        private void btnSelectAll_Click(object sender, EventArgs e)
        {
            if (num == 0)
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug.zip
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Debug/WFormReadData_SMR.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/Èý×ø±êDebug.zip
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/µã½º³ÆÖØDebug.zip
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/×é×°Debug.zip
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/bin/ÀصñDebug.zip
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.AssemblyReference.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.FileListAbsolute.txt
@@ -117,3 +117,4 @@
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.CopyComplete
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.exe
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.pdb
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormReadData_SMR\obj\Debug\WFormReadData_SMR.csproj.AssemblyReference.cache
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.csproj.GenerateResource.cache
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormReadData_SMR/obj/Debug/WFormReadData_SMR.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/Form1.cs
@@ -441,22 +441,28 @@
                CustomWriteLog("2.1.15 åå†™ç»“束 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                // ===== åˆ¤æ–­æ˜¯å¦è‡ªåŠ¨å®Œå·¥ =====
                DataSet dsMainFinal = oCN.RunProcReturn($"select HQty, HBadCount from Sc_StationOutBillMain where HInterID={HInterID}", "temp");
                DataSet dsMainFinal = oCN.RunProcReturn($"select HQty, HBadCount from Sc_StationOutBillMain where HInterID={HInterID}", "Sc_StationOutBillMain");
                CustomWriteLog("2.1.15 åå†™ç»“束 :" + HProcNumber + "----" + timer.Elapsed, DateTime.Now.ToString("yyyy-MM-dd"));
                if (dsMainFinal.Tables[0].Rows.Count > 0)
                {
                    double total = double.Parse(dsMainFinal.Tables[0].Rows[0]["HQty"].ToString())
                                 + double.Parse(dsMainFinal.Tables[0].Rows[0]["HBadCount"].ToString());
                    CustomWriteLog($"【完工单触发】出站单ID:{HInterID}, åˆè®¡æ•°é‡:{total} | è®¡åˆ’数量:{planQty} | æ˜¯å¦æ»¡è¶³å®Œå·¥æ¡ä»¶:{total == planQty}", DateTime.Now.ToString("yyyy-MM-dd"));
                    if (total == planQty) // planQty éœ€åœ¨å‰é¢ä»Žæµè½¬å¡èŽ·å–
                    {
                        string savePointName = "SP_" + HInterID + "_" + Guid.NewGuid().ToString("N").Substring(0, 8); // å”¯ä¸€ä¿å­˜ç‚¹å
                        oCN.RunProc($"SAVE TRANSACTION {savePointName}"); // è®¾ç½®ä¿å­˜ç‚¹
                        CustomWriteLog($"【完工单触发】出站单ID:{HInterID},", DateTime.Now.ToString("yyyy-MM-dd"));
                        string paramLog = $"BillType:3772, HProcExchInterID:{HProcExchInterID}, HProcExchEntryID:{HProcExchEntryID}, HProcExchBillNo:{HProcExchBillNo}, HMaker:{HMaker}, Type:3772";
                        CustomWriteLog($"【完工单执行】出站单ID:{HInterID}, è°ƒç”¨SaveMESEndWorkFrom_ZD方法 | å…¥å‚:{paramLog}", DateTime.Now.ToString("yyyy-MM-dd"));
                        bool completeFlag = SaveMESEndWorkFrom_ZD("3772", HProcExchInterID, HProcExchEntryID, HProcExchBillNo, HMaker, "3772");
                        if (!completeFlag)
                        {
                            // å®Œå·¥å•失败,回滚到保存点,仅撤销完工单相关操作
                            oCN.RunProc($"ROLLBACK TRANSACTION {savePointName}");
                            CustomWriteLog("生成完工单失败但出站单已保存,条码:" + HBadCodeSN, DateTime.Now.ToString("yyyy-MM-dd"));
                            CustomWriteLog($"【完工单执行】出站单ID:{HInterID}, å®Œå·¥å•生成失败! | æ¡ç :{HBadCodeSN}", DateTime.Now.ToString("yyyy-MM-dd"));
                        }
                    }
                }
@@ -1172,7 +1178,7 @@
                oCN.RunProc(" Update Sc_MESEndWorkBillMain set HBillStatus='2',HChecker='" + user + "',HCheckDate=getdate()  Where HInterID=" + HInterID.ToString());
                //根据开工单内码 å–到生产状态临时表主内码,然后更新生产状态临时表状态为:待生产  ä»»åŠ¡å•çŠ¶æ€(0待生产,1生产中,2挂起,3已完工)
                oCN.RunProc("exec h_p_JIT_MESBeginWorkBill_BeginWork @HInterId=" + HInterID + ",@flag='完工'");
                oCN.RunProc(" Update Sc_ICMOBillStatus_Tmp set hicmostatus='3',HEndDate=getdate()  Where HInterID=" + HMainSourceInterID.ToString());
                //保存后
                ds =oCN.RunProcReturn("exec h_p_Sc_MESEndWorkBill_AfterSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + 1, "h_p_Sc_MESEndWorkBill_AfterSaveCtrl");
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.application
@@ -14,7 +14,7 @@
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>tjWpgBox5mKt/YG1dkuhWnKvbOGE8XHOxIntnnQwzpI=</dsig:DigestValue>
        <dsig:DigestValue>evQC6YpArvi2H5J3/ZkjzeNA3xFoII2YpFngHiVC+u8=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.exe.manifest
@@ -54,14 +54,14 @@
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="80384">
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="87552">
      <assemblyIdentity name="WFormSynchronizeData_SMR" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
      <hash>
        <dsig:Transforms>
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>dGOszhyyBFT4eMjHQ+motXY18nqNsvKX0p5yCLc3cCA=</dsig:DigestValue>
        <dsig:DigestValue>2LGeszfUU/h+glqhlohxEurnnDGOMLZcAvQodtxNbIk=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/WFormSynchronizeData_SMR.pdb
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/bin/Debug/app.publish/WFormSynchronizeData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.application
@@ -14,7 +14,7 @@
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>tjWpgBox5mKt/YG1dkuhWnKvbOGE8XHOxIntnnQwzpI=</dsig:DigestValue>
        <dsig:DigestValue>evQC6YpArvi2H5J3/ZkjzeNA3xFoII2YpFngHiVC+u8=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.AssemblyReference.cache
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.csproj.FileListAbsolute.txt
@@ -66,4 +66,3 @@
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.csproj.CopyComplete
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.exe
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.pdb
D:\工作代码\智云迈思\单品过站插件\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\WFormSynchronizeData_SMR\obj\Debug\WFormSynchronizeData_SMR.csproj.AssemblyReference.cache
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe
Binary files differ
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.exe.manifest
@@ -54,14 +54,14 @@
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="80384">
    <dependentAssembly dependencyType="install" allowDelayedBinding="true" codebase="WFormSynchronizeData_SMR.exe" size="87552">
      <assemblyIdentity name="WFormSynchronizeData_SMR" version="1.0.0.0" language="neutral" processorArchitecture="msil" />
      <hash>
        <dsig:Transforms>
          <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
        </dsig:Transforms>
        <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
        <dsig:DigestValue>dGOszhyyBFT4eMjHQ+motXY18nqNsvKX0p5yCLc3cCA=</dsig:DigestValue>
        <dsig:DigestValue>2LGeszfUU/h+glqhlohxEurnnDGOMLZcAvQodtxNbIk=</dsig:DigestValue>
      </hash>
    </dependentAssembly>
  </dependency>
WFormSynchronizeData_SMR/WFormSynchronizeData_SMR/obj/Debug/WFormSynchronizeData_SMR.pdb
Binary files differ