private string CreateStNO() { WarehouseFacade warehouseFacade = new WarehouseFacade(base.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider); string preFix = "IN" + dbDateTime.DBDate.ToString().Substring(2); object objSerialBook = warehouseFacade.GetSerialBook(preFix); if (objSerialBook == null) { SERIALBOOK serialBook = new SERIALBOOK(); serialBook.SNPrefix = preFix; serialBook.MaxSerial = "1"; serialBook.MUser = this.GetUserCode(); serialBook.MDate = dbDateTime.DBDate; serialBook.MTime = dbDateTime.DBTime; warehouseFacade.AddSerialBook(serialBook); return(preFix + "0001"); } else { SERIALBOOK serialBook = (SERIALBOOK)objSerialBook; if (serialBook.MaxSerial == "9999") { throw new Exception("今天的入库指令号已用!"); } serialBook.MaxSerial = (Convert.ToInt32(serialBook.MaxSerial) + 1).ToString(); warehouseFacade.UpdateSerialBook(serialBook); return(serialBook.SNPrefix + serialBook.MaxSerial.PadLeft(4, '0')); } }
//生成新的OQC检验单号 /// <summary> /// 生成新的IQC检验单号 /// </summary> /// <param name="oldIqcNo">原IQC检验单号</param> /// <returns></returns> private string CreateNewIqcNo(string oldOqcNo) { //规则:原OQC检验单号 +_+ 两位流水号,如:OQCASN00000101_01 WarehouseFacade warehouseFacade = new WarehouseFacade(this.DataProvider); string SNPrefix = oldOqcNo + "_"; object objSerialBook = warehouseFacade.GetSerialBook(SNPrefix); if (objSerialBook == null) { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); SERIALBOOK serialBook = new SERIALBOOK(); serialBook.SNPrefix = SNPrefix; serialBook.MaxSerial = "1"; serialBook.MUser = this.GetUserCode(); serialBook.MDate = dbDateTime.DBDate; serialBook.MTime = dbDateTime.DBTime; warehouseFacade.AddSerialBook(serialBook); return(SNPrefix + "01"); } else { SERIALBOOK serialBook = (SERIALBOOK)objSerialBook; if (serialBook.MaxSerial == "99") { return(""); } serialBook.MaxSerial = (Convert.ToInt32(serialBook.MaxSerial) + 1).ToString(); warehouseFacade.UpdateSerialBook(serialBook); return(serialBook.SNPrefix + serialBook.MaxSerial.PadLeft(2, '0')); } }
private void SaveDocmentsNo(string newKzCode, string userCode) { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); _WarehouseFacade = new WarehouseFacade(DataProvider); SERIALBOOK serialbook = new SERIALBOOK(); serialbook.SNPrefix = newKzCode.Substring(0, 7); serialbook.MaxSerial = newKzCode.Substring(7, 3); serialbook.MDate = dbDateTime.DBDate; //当前日期 serialbook.MTime = dbDateTime.DBTime; //当前时间 serialbook.MUser = userCode; //维护人=登录用户 string oldserial = _WarehouseFacade.GetMaxSerial(serialbook.SNPrefix); //通过前缀获取流水号 if (oldserial == "") { _WarehouseFacade.AddSerialBook(serialbook);//新增到serialbook表 } else { _WarehouseFacade.UpdateSerialBook(serialbook);//更新到serialbook表 } }
//新建 protected void cmdNew_ServerClick(object sender, System.EventArgs e) { WarehouseFacade warehouseFacade = new WarehouseFacade(this.DataProvider); string preFix = "MES"; object objSerialBook = warehouseFacade.GetSerialBook(preFix); if (objSerialBook == null) { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); SERIALBOOK serialBook = new SERIALBOOK(); serialBook.SNPrefix = preFix; serialBook.MaxSerial = "1"; serialBook.MUser = this.GetUserCode(); serialBook.MDate = dbDateTime.DBDate; serialBook.MTime = dbDateTime.DBTime; try { warehouseFacade.AddSerialBook(serialBook); this.txtMaterialNO.Text = "MES000001"; } catch (Exception ex) { WebInfoPublish.Publish(this, "新建失败:" + ex.Message, this.languageComponent1); } } else { SERIALBOOK serialBook = (SERIALBOOK)objSerialBook; if (serialBook.MaxSerial == "999999") { WebInfoPublish.Publish(this, "物料编码已用完!", this.languageComponent1); return; } serialBook.MaxSerial = (Convert.ToInt32(serialBook.MaxSerial) + 1).ToString(); try { warehouseFacade.UpdateSerialBook(serialBook); this.txtMaterialNO.Text = serialBook.SNPrefix + serialBook.MaxSerial.PadLeft(6, '0'); } catch (Exception ex) { WebInfoPublish.Publish(this, "新建失败:" + ex.Message, this.languageComponent1); } } }
private string CreateSerialNo(int stno) { DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); if (_TransferFacade == null) { _TransferFacade = new WarehouseFacade(this.DataProvider); } string maxserial = _TransferFacade.GetMaxSerial("CT" + stno); //如果已是最大值就返回为空 if (maxserial == "999999999") { return(""); } SERIALBOOK serialbook = new SERIALBOOK(); if (maxserial == "") { serialbook.SNPrefix = "CT" + stno; serialbook.MaxSerial = "1"; serialbook.MDate = dbDateTime.DBDate; serialbook.MTime = dbDateTime.DBTime; serialbook.MUser = this.GetUserCode(); _TransferFacade.AddSerialBook(serialbook); return(string.Format("{0:000000000}", int.Parse(serialbook.MaxSerial))); } else { serialbook.SNPrefix = "CT" + stno; serialbook.MaxSerial = (int.Parse(maxserial) + 1).ToString(); serialbook.MDate = dbDateTime.DBDate; serialbook.MTime = dbDateTime.DBTime; serialbook.MUser = this.GetUserCode(); _TransferFacade.UpdateSerialBook(serialbook); return(string.Format("{0:000000000}", int.Parse(serialbook.MaxSerial))); } }