Ejemplo n.º 1
0
        private void PrintSFCSn_Load(object sender, EventArgs e)
        {
            try
            {
                #region 添加应用程序
                if (this.mFrm.gUserInfo.rolecaption == "系统开发员")
                {
                    IList <IDictionary <string, object> > lsfunls = new List <IDictionary <string, object> >();
                    FrmBLL.publicfuntion.GetFromCtls(this, ref lsfunls);
                    Dictionary <string, object> dic = new Dictionary <string, object>();
                    dic.Add("PROGID", this.Name);
                    dic.Add("PROGNAME", this.Text);
                    dic.Add("PROGDESC", this.Text);
                    FrmBLL.publicfuntion.AddProgInfo(dic, lsfunls);
                }
                #endregion
                //for (int i = 1; i < 32; i++)
                //{
                //    if (i < 13)
                //        this.strMonth.Add(i, FrmBLL.publicfuntion.h2x(i, 36));
                //    this.strDay.Add(i, FrmBLL.publicfuntion.h2x(i, 36));
                //}
                FillFacName();
                FillWoList();
                GetDateTime();

                delegateLoadlppxApp = new LoadLppxApp(LoadLppx);
                iasyncresult        = delegateLoadlppxApp.BeginInvoke("", "", "", 0, null, null);
            }
            catch (Exception ex)
            {
                this.mFrm.ShowPrgMsg(ex.Message, MainParent.MsgType.Error);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 记录SN区间
        /// </summary>
        private void RunSnRule()
        {
            //12码序列号= 1位工厂编号+两位年+一位月1~C+一位日1~V+5位流水号16进制
            if (this.iasyncresult1 != null && !this.iasyncresult1.IsCompleted)
            {
                this.mFrm.ShowPrgMsg("程序正在进行中,请稍候.1.", MainParent.MsgType.Warning);
                return;
            }
            _snstart = string.Empty;
            _snend   = string.Empty;

            int printNum = (int)this.num_printnum.Value - 1;
            //  BLL.Db_Procedure sss = new BLL.Db_Procedure();
            string C_MAXSN = string.Empty;
            string C_WOID  = string.Empty;
            string C_ROWID = string.Empty;

            //  sss.PRO_GETSNEND(out C_MAXSN, out C_WOID, out C_ROWID);
            string[] MaxSn = RefWebService_BLL.refWebtWoInfo.Instance.GetMaxSn();
            if (MaxSn[0] == "NO SN")
            {
                MaxSn[2] = "0";
                MaxSn[1] = "xxxxxxxxxx";
                string yyWeek = ServerTime.Year.ToString().Substring(2, 2) + FrmBLL.DayWeek.WeekOfYear(ServerTime).ToString().PadLeft(2, '0');
                MaxSn[0] = FacCode + yyWeek + "000000";
            }
            else
            {
                if (FrmBLL.publicfuntion.x2h(MaxSn[0].Substring(1, MaxSn[0].Length - 7), 36) > FrmBLL.publicfuntion.x2h(this.snhead, 36))
                {
                    this.mFrm.ShowPrgMsg(string.Format("日期错误:{0}<{1}", this.snhead, MaxSn[0].Substring(1, MaxSn[0].Length - 7)), MainParent.MsgType.Warning);
                    return;
                }
            }
            if (FrmBLL.DayWeek.ChkStartWeek(this.ServerTime) && MaxSn[0].Substring(1, MaxSn[0].Length - 7) != this.snhead)
            {
                _snstart = "000001";
            }
            else
            {
                _snstart = FrmBLL.publicfuntion.h2x(FrmBLL.publicfuntion.x2h(MaxSn[0].Substring(MaxSn[0].Length - 6, 6), 36) + 1, 36);
            }
            _snstart = ("000000" + _snstart).Substring(("000000" + _snstart).Length - 6, 6);
            if (MaxSn[1].ToUpper() == this.cb_woid.Text.ToUpper())
            {
                _snend = ("000000" + FrmBLL.publicfuntion.h2x(FrmBLL.publicfuntion.x2h(_snstart, 36) + printNum, 36));

                Dictionary <string, object> mst = new Dictionary <string, object>();
                mst.Add("SNPREFIX", string.IsNullOrEmpty(this.tb_snprefix.Text) ? "NA" : tb_snprefix.Text);
                mst.Add("SNPOSTFIX", string.IsNullOrEmpty(this.tb_postfix.Text) ? "NA" : tb_postfix.Text);
                mst.Add("SNEND", string.Format("{0}{1}{2}", FacCode, this.snhead, _snend = _snend.Substring(_snend.Length - 6, 6)));
                mst.Add("VER", "NA");
                mst.Add("REVE", "NA");
                mst.Add("CURRSN", "1");
                mst.Add("ROWID", MaxSn[2]);
                RefWebService_BLL.refWebtWoInfo.Instance.UpdateSnRule(FrmBLL.ReleaseData.DictionaryToJson(mst));
                //RefWebService_BLL.refWebtWoInfo.Instance.UpdateSnRule(new WebServices.tWoInfo.tSnRule()
                //{
                //    snprefix = string.IsNullOrEmpty(this.tb_snprefix.Text) ? "NA" : tb_snprefix.Text,
                //    snpostfix = string.IsNullOrEmpty(this.tb_postfix.Text) ? "NA" : tb_postfix.Text,
                //    snend = string.Format("{0}{1}{2}", FacCode, this.snhead, _snend = _snend.Substring(_snend.Length - 6, 6)),
                //    ver = "NA",
                //    reve = "NA",
                //    currsn ="1"
                //}, MaxSn[2]);
            }
            else
            {
                _snend = "000000" + FrmBLL.publicfuntion.h2x(FrmBLL.publicfuntion.x2h(_snstart, 36) + printNum, 36);

                Dictionary <string, object> dic = new Dictionary <string, object>();
                dic.Add("WOID", this.cb_woid.Text);
                dic.Add("SNPREFIX", string.IsNullOrEmpty(this.tb_snprefix.Text) ? "NA" : tb_snprefix.Text);
                dic.Add("SNPOSTFIX", string.IsNullOrEmpty(this.tb_postfix.Text) ? "NA" : tb_postfix.Text);
                dic.Add("SNSTART", string.Format("{0}{1}{2}", this.FacCode, this.snhead, ("000000" + _snstart).Substring(("000000" + _snstart).Length - 6, 6)));
                dic.Add("SNEND", string.Format("{0}{1}{2}", this.FacCode, this.snhead, _snend = _snend.Substring(_snend.Length - 6, 6)));
                dic.Add("CURRSN", "1");
                dic.Add("REVE", "NA");
                dic.Add("VER", "NA");
                RefWebService_BLL.refWebtWoInfo.Instance.InsetSnRule(FrmBLL.ReleaseData.DictionaryToJson(dic));
                //RefWebService_BLL.refWebtWoInfo.Instance.InsetSnRule(new WebServices.tWoInfo.tSnRule()
                //{
                //    woid = this.cb_woid.Text,
                //    snprefix = string.IsNullOrEmpty(this.tb_snprefix.Text) ? "NA" : tb_snprefix.Text,
                //    snpostfix = string.IsNullOrEmpty(this.tb_postfix.Text) ? "NA" : tb_postfix.Text,
                //    snstart = string.Format("{0}{1}{2}", this.FacCode, this.snhead, ("000000" + _snstart).Substring(("000000" + _snstart).Length - 6, 6)),
                //    snend = string.Format("{0}{1}{2}", this.FacCode, this.snhead, _snend = _snend.Substring(_snend.Length - 6, 6)),
                //     currsn="1",
                //      reve="NA",
                //       ver="NA"
                //});
            }
            this.ShowMsg(LogMsgType.Outgoing, "数据记录成功\n开始执行打印:");
            this.ShowSection(printNum);
            int dp = printNum + 1;

            if (this.rb_printmodel1.Checked)
            {
                Print2(this._snstart, this.FacCode + this.snhead, this.cb_woid.Text + "/" + this.mProductName, printNum + 1);
            }
            else
            {
                delegateLoadlppxApp = new LoadLppxApp(PrintLable);
                iasyncresult1       = delegateLoadlppxApp.BeginInvoke(this.facNameAndfacCode[this.cb_facname.Text] + this.snhead,
                                                                      this._snstart, this.cb_woid.Text + "/" + this.mProductName, dp, null, null);
            }
        }