protected override bool ValidateInput() { if (_DocumentFacade == null) { _DocumentFacade = new DocumentFacade(this.DataProvider); } if (!_DocumentFacade.GetDocDirRight(int.Parse(this.txtDocDirQuery.Text.Trim()), this.GetUserCode(), "UPLOAD")) { WebInfoPublish.PublishInfo(this, "$Error_No_UploadFile_Right", this.languageComponent1); return(false); } PageCheckManager manager = new PageCheckManager(); manager.Add(new LengthCheck(lblDocNameEdit, txtDocNameEdit, 40, true)); manager.Add(new LengthCheck(lblDocNumEdit, txtDocNumEdit, 40, true)); manager.Add(new NumberCheck(lblDocVerEdit, txtDocVerEdit, true)); manager.Add(new LengthCheck(lblDocVerEdit, txtDocVerEdit, 40, true)); manager.Add(new LengthCheck(lblMemoEdit, txtMemoEdit, 2000, true)); manager.Add(new LengthCheck(lblKeyWordEdit, txtKeyWordEdit, 2000, true)); manager.Add(new LengthCheck(lblFileTypeEdit, drpDocTypeEdit, 40, true)); //if (this.txtDocVerEdit.Text.Trim().Length != 2) //{ // WebInfoPublish.PublishInfo(this, "$Error_Version_Length", this.languageComponent1); // return false; //} if (this.cmdAdd.Disabled) { if (_DocumentFacade.CheckVertion(txtDocSerialEdit.Text.Trim(), txtDocVerEdit.Text, FormatHelper.CleanString(txtDocNameEdit.Text), FormatHelper.CleanString(txtDocNumEdit.Text))) { WebInfoPublish.PublishInfo(this, "$Error_Version_Check", this.languageComponent1); return(false); } } else { if (_DocumentFacade.CheckVertion(txtDocVerEdit.Text, FormatHelper.CleanString(txtDocNameEdit.Text), FormatHelper.CleanString(txtDocNumEdit.Text))) { WebInfoPublish.PublishInfo(this, "$Error_Version_Check", this.languageComponent1); return(false); } } if (!manager.Check()) { WebInfoPublish.PublishInfo(this, manager.CheckMessage, this.languageComponent1); return(false); } if (this.chbFileCheckedEdit.Checked) { HttpPostedFile postedFile = fileUpload.PostedFile; if (postedFile.FileName.Trim() == string.Empty) { WebInfoPublish.PublishInfo(this, "$Error_UploadFileIsEmpty", this.languageComponent1); return(false); } } return(true); }
protected override void Grid_ClickCellButton(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e) { string userCode = this.GetUserCode(); if (this.gridHelper.IsClickColumn("SyncStatus", e)) { if (string.Compare(e.Cell.Row.Cells.FromKey("Status").Value.ToString(), FlagStatus.FlagStatus_MES, true) != 0 && string.Compare(e.Cell.Row.Cells.FromKey("Status").Value.ToString(), FlagStatus.FlagStatus_POST, true) != 0) { WebInfoPublish.Publish(this, "$Error_OnlyMESAndPOSTStatusCanDo", this.languageComponent1); } else { this.iqcFacade.ManualSyncMaterialReceiveFlag( e.Cell.Row.Cells.FromKey("IQCNo").Value.ToString(), int.Parse(e.Cell.Row.Cells.FromKey("STLine").Value.ToString()), userCode); this.cmdQuery_Click(null, null); } } //if (this.gridHelper.IsClickColumn("ConfirmReceiveAgain", e)) //{ // if (string.Compare(e.Cell.Row.Cells.FromKey("Status").Value.ToString(), FlagStatus.FlagStatus_MES, true) != 0) // { // WebInfoPublish.Publish(this, "$Error_OnlyMESStatusCanDo", this.languageComponent1); // } // else // { // MaterialReceive mr = this.iqcFacade.GetMaterialReceive(e.Cell.Row.Cells.FromKey("IQCNo").Value.ToString(), // int.Parse(e.Cell.Row.Cells.FromKey("STLine").Value.ToString())) as MaterialReceive; // if (mr != null) // { // // 再次报工 // DT_MES_SOURCESTOCK_REQLIST po = Post2SAPUtility.GenerateSAPPOInfo(mr); // MaterialPOTransferArgument mpArg = new MaterialPOTransferArgument(this.DataProvider); // mpArg.InventoryList.Add(po); // mr.TransactionCode = mpArg.TransactionCode; // this.iqcFacade.UpdateMaterialReceive(mr); // ServiceResult sr = Post2SAPUtility.CallSAPInterface(mpArg); // if (sr.Result == true) // { // } // else // { // WebInfoPublish.Publish(this, sr.Message + " Transaction Code=" + sr.TransactionCode, this.languageComponent1); // } // } // } //} else if (this.gridHelper.IsClickColumn("SRMSyncStatus", e)) { if (!this.iqcFacade.IsFromASN(e.Cell.Row.Cells.FromKey("STNo").Value.ToString())) { WebInfoPublish.Publish(this, "$Error_OnlyFromASNCanDo", this.languageComponent1); } else if (string.Compare(e.Cell.Row.Cells.FromKey("SRMFlag").Value.ToString(), FlagStatus.FlagStatus_MES, true) != 0) { WebInfoPublish.Publish(this, "$Error_OnlyMESStatusCanDo", this.languageComponent1); } else { this.iqcFacade.ManualSyncIQCDetailSRMFlag( e.Cell.Row.Cells.FromKey("IQCNo").Value.ToString(), int.Parse(e.Cell.Row.Cells.FromKey("STLine").Value.ToString()), userCode); this.cmdQuery_Click(null, null); } } }
protected void cmdSave_ServerClick(object sender, System.EventArgs e) { if (!SaveCheck()) { return; } AlertDirectPass alertDirectPass = new AlertDirectPass(); alertDirectPass.ItemSequence = this.txtAlertItemSequence.Text; alertDirectPass.ItemType = this.ddlItemType.SelectedValue; alertDirectPass.BaseOutput = int.Parse(this.txtBaseOutPut.Text); alertDirectPass.TimeDimension = this.rblTimeDimensionGroup.SelectedValue; //产生预警通告 if (this.chbGenerateNotice.Checked) { alertDirectPass.GenerateNotice = "Y"; } else { alertDirectPass.GenerateNotice = "N"; } //发送邮件 if (this.chbSendMail.Checked) { int count = this._AlertFacade.QueryAlertMailSettingsCount(alertDirectPass.ItemSequence); if (count > 0) { alertDirectPass.SendMail = "Y"; } else { WebInfoPublish.Publish(this, "$Error_EmailSetup_Need", this._LanguageComponent1); return; } } else { alertDirectPass.SendMail = "N"; } //停线控制 if (this.chbLinePause.Checked) { alertDirectPass.LinePause = "Y"; } else { alertDirectPass.LinePause = "N"; } decimal alertValue = Math.Round(Decimal.Parse(this.txtAlertStandard.Text), 2); if (alertValue >= 1) { alertValue = 0.99m; } else if (alertValue <= 0) { alertValue = 0.01m; } alertDirectPass.AlertValue = alertValue; alertDirectPass.MaintainDate = FormatHelper.TODateInt(DateTime.Now.ToShortDateString()); alertDirectPass.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); alertDirectPass.MaintainUser = this.GetUserCode(); this._AlertFacade.SaveAlertDirectPass(alertDirectPass); WebInfoPublish.Publish(this, "$CS_Save_Success", this._LanguageComponent1); }
//新增 protected override void AddDomainObject(object domainObject) { if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(base.DataProvider); } ItemFacade itemFacade = new ItemFacade(this.DataProvider); string dQMCode = FormatHelper.CleanString(this.txtMaterialNO.Text); Domain.MOModel.Material material = (Domain.MOModel.Material)itemFacade.GetMaterialByDQMCode(dQMCode); Domain.MOModel.Material newMaterial = null; DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); try { this.DataProvider.BeginTransaction(); //如果该物料编码不存在物料主表,新增一笔数据 if (material == null) { newMaterial = new Domain.MOModel.Material(); newMaterial.MCode = FormatHelper.CleanString(this.txtMaterialNO.Text, 40); newMaterial.DqmCode = FormatHelper.CleanString(this.txtMaterialNO.Text, 40); newMaterial.MspecialDesc = FormatHelper.CleanString(this.txtSpecialDescEdit.Text, 200); newMaterial.Muom = FormatHelper.CleanString(this.txtUnitEdit.Text, 40); newMaterial.MType = "itemtype_finishedproduct"; newMaterial.Sourceflag = "MES"; newMaterial.CUser = this.GetUserCode(); newMaterial.CDate = dbDateTime.DBDate; newMaterial.CTime = dbDateTime.DBTime; newMaterial.MaintainUser = this.GetUserCode(); } if (newMaterial != null) { itemFacade.AddMaterial(newMaterial); } //同时更新库存 SpecStorageInfo specStorageInfo = (SpecStorageInfo)_InventoryFacade.GetSpecStorageInfo(((SpecInOut)domainObject).StorageCode, ((SpecInOut)domainObject).MCode, ((SpecInOut)domainObject).LocationCode); if (specStorageInfo != null) { specStorageInfo.StorageQty = specStorageInfo.StorageQty + Convert.ToInt32(this.txtQTY.Text.Trim()); this._InventoryFacade.UpdateSpecStorageInfo(specStorageInfo); } else { specStorageInfo = this._InventoryFacade.CreateNewSpecStorageInfo(); specStorageInfo.MCode = ((SpecInOut)domainObject).MCode; specStorageInfo.DQMCode = ((SpecInOut)domainObject).DQMCode; specStorageInfo.Muom = ((SpecInOut)domainObject).Muom; specStorageInfo.StorageCode = ((SpecInOut)domainObject).StorageCode; specStorageInfo.LocationCode = ((SpecInOut)domainObject).LocationCode; specStorageInfo.StorageQty = ((SpecInOut)domainObject).Qty; specStorageInfo.CUser = this.GetUserCode(); specStorageInfo.CDate = dbDateTime.DBDate; specStorageInfo.CTime = dbDateTime.DBTime; specStorageInfo.MaintainUser = this.GetUserCode(); this._InventoryFacade.AddSpecStorageInfo(specStorageInfo); } this._InventoryFacade.AddSpecInOut((SpecInOut)domainObject); this.DataProvider.CommitTransaction(); } catch (Exception ex) { WebInfoPublish.Publish(this, "新增失败:" + ex.Message, this.languageComponent1); this.DataProvider.RollbackTransaction(); } }
protected void cmdBack_ServerClick(object sender, System.EventArgs e) { ArrayList array = this.gridHelper.GetCheckedRows(); if (array.Count > 0) { ArrayList items = new ArrayList(); foreach (GridRecord row in array) { object iqcHead = this.GetEditObject(row); if (iqcHead != null) { object[] iqcDetail = _IQCFacade.QueryIQCDetailByIQCNO(((IQCHead)iqcHead).IQCNo); bool hasChecked = false; foreach (object item in iqcDetail) { if (((IQCDetail)item).STDStatus == IQCStatus.IQCStatus_New) { WebInfoPublish.Publish(this, "$HAS_NOT_SEND_CHENK $IQCNo:" + ((IQCHead)iqcHead).IQCNo, this.languageComponent1); this.RequestData(); return; } if (((IQCDetail)item).STDStatus == IQCStatus.IQCStatus_Close) { WebInfoPublish.Publish(this, "$HAS_CLOSED_CAN_NOT_GOBACK $IQCNo:" + ((IQCHead)iqcHead).IQCNo, this.languageComponent1); this.RequestData(); return; } if (((IQCDetail)item).STDStatus == IQCStatus.IQCStatus_Cancel) { WebInfoPublish.Publish(this, "$HAS_CANCEL_CAN_NOT_GOBACK $IQCNo:" + ((IQCHead)iqcHead).IQCNo, this.languageComponent1); this.RequestData(); return; } if (((IQCDetail)item).CheckStatus != IQCCheckStatus.IQCCheckStatus_WaitCheck) { hasChecked = true; } } if (hasChecked) { WebInfoPublish.Publish(this, "$HAS_CHECKED_CAN_NOT_GOBACK $IQCNo:" + ((IQCHead)iqcHead).IQCNo, this.languageComponent1); this.RequestData(); return; } items.Add((IQCHead)iqcHead); } } string message = string.Empty; message += "$Message_BackSuccess $IQCNo" + " : \n"; this.DataProvider.BeginTransaction(); try { foreach (IQCHead iqcHead in items) { object objASN = _IQCFacade.GetASN(iqcHead.STNo); ((ASN)objASN).STStatus = "NEW"; _IQCFacade.UpdateASN((ASN)objASN); object objIQCHead = _IQCFacade.GetIQCHead(iqcHead.IQCNo); ((IQCHead)objIQCHead).Status = IQCStatus.IQCStatus_New; _IQCFacade.UpdateIQCHead((IQCHead)objIQCHead); object[] objIQCDetail = _IQCFacade.QueryIQCDetailByIQCNO(iqcHead.IQCNo); foreach (object obj in objIQCDetail) { ((IQCDetail)obj).STDStatus = IQCStatus.IQCStatus_New; ((IQCDetail)obj).CheckStatus = " "; _IQCFacade.UpdateIQCDetail((IQCDetail)obj); } object objINVReceipt = _IQCFacade.GetInvReceipt(iqcHead.STNo); ((InvReceipt)objINVReceipt).Recstatus = "NEW"; _IQCFacade.UpdateInvReceipt((InvReceipt)objINVReceipt); object[] objINVReceiptDetail = _IQCFacade.GetInvReceiptDetailForUpdate(iqcHead.STNo); foreach (object obj in objINVReceiptDetail) { ((InvReceiptDetail)obj).Recstatus = "NEW"; ((InvReceiptDetail)obj).Iqcstatus = "NEW"; _IQCFacade.UpdateInvReceiptDetail((InvReceiptDetail)obj); } message += iqcHead.IQCNo + "\n"; } } catch (Exception ex) { this.DataProvider.RollbackTransaction(); } this.DataProvider.CommitTransaction(); this.RequestData(); this.buttonHelper.PageActionStatusHandle(PageActionType.Query); if (message.Trim().Length > 0) { WebInfoPublish.PublishInfo(this, message, languageComponent1); } } }
private void _helper_LoadGridDataSource(object sender, EventArgs e) { if (this.chbExpDetail.Checked && this.hidAction.Value == "exp") { #region 导出二级界面 PageCheckManager manager = new PageCheckManager(); manager.Add(new DateRangeCheck(this.lblInDateQuery, this.dateInDateFromQuery.Text, this.dateInDateToQuery.Text, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return; } BenQGuru.eMES.Common.Domain.IDomainDataProvider provider = null; try { provider = base.DataProvider; BenQGuru.eMES.Material.InventoryFacade facade = new InventoryFacade(provider); object[] dataSource = facade.QueryRecRCardWeb( this.txtCartonNo.Text.Trim().ToUpper(), this.txtReceivQuery.Text.Trim(), this.drpStatus.SelectedValue, this.dateInDateFromQuery.Text, this.dateInDateToQuery.Text, this.txtModel.Text.Trim(), this.txtItemCode.Text.Trim(), this.txtRCardFrom.Text.Trim(), this.txtRCardTo.Text, this.drpRecType.SelectedValue, (e as WebQueryEventArgs).StartRow, (e as WebQueryEventArgs).EndRow); (e as WebQueryEventArgs).GridDataSource = dataSource; } finally { if (provider != null) { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)provider).PersistBroker.CloseConnection(); } } #endregion } else { #region 导出二级界面 PageCheckManager manager = new PageCheckManager(); manager.Add(new DateRangeCheck(this.lblInDateQuery, this.dateInDateFromQuery.Text, this.dateInDateToQuery.Text, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return; } BenQGuru.eMES.Common.Domain.IDomainDataProvider provider = null; try { provider = base.DataProvider; BenQGuru.eMES.Material.InventoryFacade facade = new InventoryFacade(provider); object[] dataSource = facade.QueryInvReceiveWeb( this.txtCartonNo.Text.Trim().ToUpper(), this.txtReceivQuery.Text.Trim(), this.drpStatus.SelectedValue, this.dateInDateFromQuery.Text, this.dateInDateToQuery.Text, this.txtModel.Text.Trim(), this.txtItemCode.Text.Trim(), this.txtRCardFrom.Text.Trim(), this.txtRCardTo.Text, this.drpRecType.SelectedValue, this.txtConditionMo.Text, (e as WebQueryEventArgs).StartRow, (e as WebQueryEventArgs).EndRow); (e as WebQueryEventArgs).GridDataSource = dataSource; (e as WebQueryEventArgs).RowCount = facade.QueryInvReceiveWebCount( this.txtCartonNo.Text.Trim().ToUpper(), this.txtReceivQuery.Text.Trim(), this.drpStatus.SelectedValue, this.dateInDateFromQuery.Text, this.dateInDateToQuery.Text, this.txtModel.Text.Trim(), this.txtItemCode.Text.Trim(), this.txtRCardFrom.Text.Trim(), this.txtRCardTo.Text, this.drpRecType.SelectedValue, this.txtConditionMo.Text); } finally { if (provider != null) { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)provider).PersistBroker.CloseConnection(); } } #endregion } }
private int GetRowCount() { if (this.txtActstarDateFrom.Text.Trim() != string.Empty) { PageCheckManager manager = new PageCheckManager(); manager.Add(new LengthCheck(this.lblActstarDateFrom, this.txtActstarDateFrom, 5, false)); manager.Add(new NumberCheck(this.lblActstarDateFrom, this.txtActstarDateFrom, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(0); } } if (this.txtActstarDateTo.Text.Trim() != string.Empty) { PageCheckManager manager = new PageCheckManager(); manager.Add(new LengthCheck(this.lblActstarDateTo, this.txtActstarDateTo, 5, false)); manager.Add(new NumberCheck(this.lblActstarDateTo, this.txtActstarDateTo, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(0); } } if (this.txtActstarDateFrom.Text.Trim() != string.Empty && this.txtActstarDateTo.Text.Trim() != string.Empty) { if (Convert.ToInt32(this.txtActstarDateTo.Text.Trim()) - Convert.ToInt32(this.txtActstarDateFrom.Text.Trim()) < 0) { WebInfoPublish.Publish(this, "$CS_ActstarDate_Must_Over_Zero", this.languageComponent1); return(0); } } int ActstarDateFrom = 0; if (this.txtActstarDateTo.Text.Trim() != string.Empty) { ActstarDateFrom = FormatHelper.TODateInt(DateTime.Now.Date.AddDays(-Convert.ToInt32(this.txtActstarDateTo.Text.Trim()))); } int ActstarDateTo = 0; if (this.txtActstarDateFrom.Text.Trim() != string.Empty && Convert.ToInt32(this.txtActstarDateFrom.Text.Trim()) != 0) { ActstarDateTo = FormatHelper.TODateInt(DateTime.Now.Date.AddDays(-Convert.ToInt32(this.txtActstarDateFrom.Text.Trim()))); } if (_facade == null) { _facade = new MOFacade(base.DataProvider); } if (this.chbImportDate.Checked && this.chbUseDate.Checked) { return(this._facade.QueryMOIllegibilityCount( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), FormatHelper.TODateInt(this.dateInDateFromQuery.Text), FormatHelper.TODateInt(this.dateInDateToQuery.Text), FormatHelper.TODateInt(this.ImportDateFrom.Text), FormatHelper.TODateInt(this.ImportDateTo.Text), ActstarDateFrom, ActstarDateTo)); } else if (this.chbImportDate.Checked && !this.chbUseDate.Checked) { return(this._facade.QueryMOIllegibilityCount( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), 0, 0, FormatHelper.TODateInt(this.ImportDateFrom.Text), FormatHelper.TODateInt(this.ImportDateTo.Text), ActstarDateFrom, ActstarDateTo)); } else if (!this.chbImportDate.Checked && this.chbUseDate.Checked) { return(this._facade.QueryMOIllegibilityCount( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), FormatHelper.TODateInt(this.dateInDateFromQuery.Text), FormatHelper.TODateInt(this.dateInDateToQuery.Text), 0, 0, ActstarDateFrom, ActstarDateTo)); } return(this._facade.QueryMOIllegibilityCount( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), 0, 0, 0, 0, ActstarDateFrom, ActstarDateTo)); }
private void GetServerClick(string clickName) { if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(base.DataProvider); } ArrayList array = this.gridHelper.GetCheckedRows(); object obj = null; if (array.Count > 0) { //判断是否符合条件 foreach (GridRecord row in array) { obj = this.GetEditObject(row); if (obj != null) { Storloctrans storloctrans = obj as Storloctrans; if (clickName == "Release") { if (storloctrans.Status != StorageTrans_STATUS.Trans_Release) { WebInfoPublish.Publish(this, storloctrans.Transno + "非待转储状态,不能下发", this.languageComponent1); return; } if (string.IsNullOrEmpty(storloctrans.StorageCode)) { WebInfoPublish.Publish(this, storloctrans.Transno + "转储单的目标库位不能为空", this.languageComponent1); return; } if (string.IsNullOrEmpty(storloctrans.FromstorageCode)) { WebInfoPublish.Publish(this, storloctrans.Transno + "转储单的原库位不能为空", this.languageComponent1); return; } if (storloctrans.Status == "Cancel") { WebInfoPublish.Publish(this, storloctrans.Transno + "已取消不能下发!", this.languageComponent1); return; } } else if (clickName == "ReleaseCancel") { if (storloctrans.Status != StorageTrans_STATUS.Trans_Pick) { WebInfoPublish.Publish(this, storloctrans.Transno + "非拣料状态,不能取消下发", this.languageComponent1); return; } object[] objDetail = _WarehouseFacade.QueryDetailBYNo(storloctrans.Transno); bool isAllRelease = true; if (objDetail != null) { foreach (StorloctransDetail sdetail in objDetail) { if (sdetail.Status != StorageTrans_STATUS.Trans_Release)//判断明细是否全是初始状态 { isAllRelease = false; } } } if (!isAllRelease) { WebInfoPublish.Publish(this, storloctrans.Transno + " 明细不全是待转储状态,不能取消下发", this.languageComponent1); return; } } } } List <Storloctrans> objList = new List <Storloctrans>(); foreach (GridRecord row in array) { obj = this.GetEditObject(row); if (obj != null) { objList.Add((Storloctrans)obj); } } this.UpdateTrans(objList, clickName); this.gridHelper.RequestData(); this.buttonHelper.PageActionStatusHandle(PageActionType.Add); } }
private void DoSuitInButton(string workPlanActionStatus) { if (_facade == null) { _facade = new MaterialFacade(this.DataProvider); } ArrayList arryList = this.gridHelper.GetCheckedRows(); if (arryList.Count == 0) { WebInfoPublish.Publish(this, "$CS_CHOOSE_ONE_RECORD_AT_LEAST", languageComponent1); return; } List <WorkPlan> workPlanList = new List <WorkPlan>(); DBDateTime dBDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); foreach (UltraGridRow row in arryList) { if (row.Cells.FromKey("ActionStatus").Text == this.languageComponent1.GetString(WorkPlanActionStatus.WorkPlanActionStatus_Close) || row.Cells.FromKey("ActionStatus").Text == this.languageComponent1.GetString(WorkPlanActionStatus.WorkPlanActionStatus_Open)) { WebInfoPublish.Publish(this, "$WorkPlanActionStatus_Not_Right", languageComponent1); return; } if (row.Cells.FromKey("ActionStatus").Text.Trim() == this.languageComponent1.GetString(workPlanActionStatus)) { WorkPlan workPlan = (WorkPlan)_facade.GetWorkPlan(row.Cells.FromKey("BigSSCode").Text, FormatHelper.TODateInt(Convert.ToDateTime(row.Cells.FromKey("MaterialPlanDate").Text)), row.Cells.FromKey("MoCode").Text, Convert.ToDecimal(row.Cells.FromKey("MoSeq").Text.Trim())); if (workPlan != null) { if (workPlanActionStatus == WorkPlanActionStatus.WorkPlanActionStatus_Ready) { workPlan.ActionStatus = WorkPlanActionStatus.WorkPlanActionStatus_Init; } else { workPlan.ActionStatus = WorkPlanActionStatus.WorkPlanActionStatus_Ready; } workPlan.MaintainDate = dBDateTime.DBDate; workPlan.MaintainTime = dBDateTime.DBTime; workPlanList.Add(workPlan); } } } if (workPlanList.Count > 0) { try { this.DataProvider.BeginTransaction(); for (int i = 0; i < workPlanList.Count; i++) { WorkPlan workPlanToUpdate = workPlanList[i] as WorkPlan; _facade.UpdateWorkPlan(workPlanToUpdate); } this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, ex.Message, this.languageComponent1); } } }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(base.DataProvider); } if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(this.DataProvider); } Pickdetailmaterial[] pickdetailmaterialList = ((Pickdetailmaterial[])domainObjects.ToArray(typeof(Pickdetailmaterial))); try { this.DataProvider.BeginTransaction(); foreach (Pickdetailmaterial pickdetailm in pickdetailmaterialList) { #region delete //1、只有行明细是拣料中和拣料完成状态,且拣货任务令头状态是拣料状态或制作箱单状态时才可以删除。 PickDetail pickDetail = _InventoryFacade.GetPickDetail(pickdetailm.Pickno, pickdetailm.Pickline) as PickDetail; Pick pickHead = _InventoryFacade.GetPick(pickdetailm.Pickno) as Pick; if (pickDetail == null || pickHead == null) { this.DataProvider.RollbackTransaction(); return; } if (!(pickDetail.Status == PickDetail_STATUS.Status_Pick || pickDetail.Status == PickDetail_STATUS.Status_ClosePick)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "行明细是拣料中和拣料完成状态,才可以删除", this.languageComponent1); return; } if (!(pickHead.Status == PickHeadStatus.PickHeadStatus_Pick || pickHead.Status == PickHeadStatus.PickHeadStatus_MakePackingList)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "拣货任务令头状态是拣料状态或制作箱单状态时,才可以删除", this.languageComponent1); return; } // 2、删除已拣行明细后,该行状态变更为待拣料。 _WarehouseFacade.DeletePickdetailmaterial(pickdetailm); pickDetail.Status = PickDetail_STATUS.Status_Pick; //3、所有已拣行明细删除后,拣货任务令状态变更为待拣料。 int count = _WarehouseFacade.GetPickdetailmaterialCount(pickdetailm.Pickno); if (count == 0) { pickHead.Status = PickHeadStatus.PickHeadStatus_WaitPick; _WarehouseFacade.UpdatePick(pickHead); pickDetail.Status = PickDetail_STATUS.Status_WaitPick; } _WarehouseFacade.UpdatePickdetail(pickDetail); #endregion } this.DataProvider.CommitTransaction(); WebInfoPublish.Publish(this, "删除成功", this.languageComponent1); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1); } }
protected void InitialObjects(object[] asnList) { //1> 入库指令号状态为:WaitReceive:待收货,则修改入库指令号(TBLASN、TBLASNDETAIL)状态为:Release:初始化 //2> 入库指令号状态不为:WaitReceive:待收货,则报错提示当前入库指令号不能取消下发 try { InventoryFacade facade = new InventoryFacade(base.DataProvider); WarehouseFacade _wa = new WarehouseFacade(DataProvider); //foreach (ASN asn in asnList) // { ASN asn = (ASN)asnList[0]; if (asn.Status != "Release" && asn.Status != "Receive" && asn.Status != "WaitReceive") { WebInfoPublish.Publish(this, asn.StNo + "入库指令号不能取消下发,状态必须是到货初检中才能取消下发", this.languageComponent1); return; } this.DataProvider.BeginTransaction(); _wa.UpdateASNForCancelDown(new string[] { asn.StNo }, "Release"); facade.UpdateASNDetail(asn.StNo, ASNHeadStatus.Release); facade.UpdateASNDetailSN(asn.StNo); //facade.UpdateASNDetailItem(asn.StNo); DBDateTime dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider); InvInOutTrans trans = _wa.CreateNewInvInOutTrans(); trans.CartonNO = string.Empty; trans.DqMCode = " "; trans.FacCode = asn.FacCode; trans.FromFacCode = string.Empty; trans.FromStorageCode = string.Empty; trans.InvNO = asn.InvNo; trans.InvType = asn.StType; trans.LotNo = string.Empty; trans.MaintainDate = dbTime1.DBDate; trans.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); trans.MaintainUser = this.GetUserCode(); trans.MCode = " "; trans.ProductionDate = 0; trans.Qty = 0; trans.Serial = 0; trans.StorageAgeDate = 0; trans.StorageCode = asn.StorageCode; trans.SupplierLotNo = string.Empty; trans.TransNO = asn.StNo; trans.TransType = "IN"; trans.Unit = string.Empty; trans.ProcessType = "CANCELISSUE"; _wa.AddInvInOutTrans(trans); this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); throw ex; } }
private void gridWebGrid_ClickCellButton(object sender, Infragistics.WebUI.UltraWebGrid.CellEventArgs e) { MO2SAP mo2sap = this._MOFacade.GetMO2SAP(this.txtMoCodeQuery.Text.ToUpper().Trim(), decimal.Parse(e.Cell.Row.Cells[0].Text)) as MO2SAP; DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); if (this.gridHelper.IsClickColumn("SyncStatus", e)) { if (string.Compare(mo2sap.Flag, "MES", true) == 0) { this.DataProvider.BeginTransaction(); try { // Update MO2SAP.Flag mo2sap.Flag = "SAP"; mo2sap.ErrorMessage = ""; mo2sap.MaintainUser = this.GetUserCode(); mo2sap.MaintainDate = dbDateTime.DBDate; mo2sap.MaintainTime = dbDateTime.DBTime; this._MOFacade.UpdateMO2SAP(mo2sap); // Update MO2SAPLog.active this._MOFacade.UpdateMO2SAPLogStatus(mo2sap.MOCode, mo2sap.PostSequence); e.Cell.Row.Cells[10].Text = "SAP"; e.Cell.Row.Cells[11].Text = ""; this.DataProvider.CommitTransaction(); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, ex.Message, this.languageComponent1); } } else { WebInfoPublish.Publish(this, "$Error_OnlyMESStatusCanDo", this.languageComponent1); } } else if (this.gridHelper.IsClickColumn("ConfirmAgain", e)) { if (string.Compare(mo2sap.Flag, "MES", true) == 0) { // Update MO2SAP mo2sap.MaintainUser = this.GetUserCode(); mo2sap.MaintainDate = dbDateTime.DBDate; mo2sap.MaintainTime = dbDateTime.DBTime; this._MOFacade.UpdateMO2SAP(mo2sap); // Update MO2SAPLog.active this._MOFacade.UpdateMO2SAPLogStatus(mo2sap.MOCode, mo2sap.PostSequence); this.CallMOConfirm(mo2sap); } else { WebInfoPublish.Publish(this, "$Error_OnlyMESStatusCanDo", this.languageComponent1); } } else if (this.gridHelper.IsClickColumn("ErrorMessage", e)) { if (string.Compare(mo2sap.Flag, "MES", true) == 0) { Response.Redirect(this.MakeRedirectUrl("FMO2SAPLogQP.aspx", new string[] { "MOCode", "PostSeq", "PageName" }, new string[] { mo2sap.MOCode, mo2sap.PostSequence.ToString(), "FMOConfirmMP.aspx" })); } else { WebInfoPublish.Publish(this, "$Error_OnlyMESStatusCanDo", this.languageComponent1); } } else { return; } }
protected override void SetEditObject(object obj) { if (_esoppicsFacade == null) { _esoppicsFacade = new BaseModelFacadeFactory(base.DataProvider).CreateEsopPicsFacade(); } if (obj == null) { this.txtItemCode.Text = string.Empty; this.txtOplist.Text = string.Empty; this.txtPICMemoEdit.Text = string.Empty; this.txtPICOrderEdit.Text = string.Empty; this.txtPICTitleEdit.Text = string.Empty; this.HiddenPicFullName.Text = string.Empty; //this.imgPic.Visible = false; this.imgPic.ImageUrl = ""; imgPicLink.Attributes["target"] = "_self"; imgPicLink.Attributes["href"] = "#"; this.HiddenPicSerial.Text = string.Empty; this.chkOInstruction.Checked = false; this.chkMInstruction.Checked = false; return; } this.txtItemCode.Text = ((Esoppics)obj).Itemcode.ToString(); this.txtOplist.Text = ((Esoppics)obj).Opcode.ToString(); //try //{ // this.DropdownlistPICType.SelectedValue = ((Esoppics)obj).Pictype.ToString(); //} //catch //{ // this.DropdownlistPICType.SelectedIndex = 0; //} this.chkOInstruction.Checked = ((Esoppics)obj).Pictype.IndexOf(PicType.Operating_Instructions) >= 0; this.chkMInstruction.Checked = ((Esoppics)obj).Pictype.IndexOf(PicType.Maintenance_instructions) >= 0; this.txtPICOrderEdit.Text = ((Esoppics)obj).Picseq.ToString(); this.txtPICMemoEdit.Text = ((Esoppics)obj).Picmemo.ToString(); this.txtPICTitleEdit.Text = ((Esoppics)obj).Pictitle.ToString(); this.HiddenPicFullName.Text = ((Esoppics)obj).Picfullname.ToString(); this.HiddenPicSerial.Text = ((Esoppics)obj).Serial.ToString(); try { if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } //object parameter = _facade.GetParameter("PICUPLOADPATH", "ESOPPICDIRPATHGROUP"); //if (parameter != null) //{ //服务器目录路径 string fileFullName = System.AppDomain.CurrentDomain.BaseDirectory + "ESFileUpload//" + (obj as Esoppics).Picfullname + ".jpg"; if (File.Exists(fileFullName)) { Response.Cache.SetCacheability(HttpCacheability.NoCache); //this.imgPic.Visible = true; this.imgPic.ImageUrl = this.VirtualHostRoot + "ESFileUpload//" + ((Esoppics)obj).Picfullname + ".jpg?i=" + DateTime.Now.Ticks; imgPicLink.Attributes["target"] = "_blank"; imgPicLink.Attributes["href"] = this.imgPic.ImageUrl; //this.imgPic.ImageUrl = "ShowImg.aspx?PICFULLNAME=" + file.Name; } else { //this.imgPic.Visible = false; this.imgPic.ImageUrl = ""; imgPicLink.Attributes["target"] = "_self"; imgPicLink.Attributes["href"] = "#"; } //} } catch (Exception ex) { WebInfoPublish.PublishInfo(this, "$Error_PicDirPath_NotExist", this.languageComponent1); return; } }
private bool UpLoadFile(string action, Esoppics pic) { if (action == "EDIT" && string.IsNullOrEmpty(this.fileUpload.Value)) { return(true); } try { if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } //object parameter = _facade.GetParameter("PICUPLOADPATH", "ESOPPICDIRPATHGROUP"); //if (parameter != null) //{ //服务器目录路径 string filePath = System.AppDomain.CurrentDomain.BaseDirectory + "ESFileUpload";//((Domain.BaseSetting.Parameter)parameter).ParameterAlias; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } if (filePath.LastIndexOf('\\') == filePath.Length - 1) { filePath = filePath.Substring(0, filePath.Length - 1); } if (pic != null) { DirectoryInfo dir = new DirectoryInfo(filePath); foreach (FileInfo file in dir.GetFiles()) { if (file.Name == (pic.Picfullname + ".jpg")) { file.Delete(); } } /// '检查文件扩展名字 HttpPostedFile postedFile = fileUpload.PostedFile; string fileName; fileName = System.IO.Path.GetFileName(postedFile.FileName); if (fileName != "") { string currentPath = filePath + "\\" + pic.Picfullname + ".jpg"; postedFile.SaveAs(currentPath); } WebInfoPublish.PublishInfo(this, "$Success_UpLoadFile", this.languageComponent1); } return(true); //} //else //{ // WebInfoPublish.PublishInfo(this, "$Error_PicDirPath_NotExist", this.languageComponent1); // return false; //} } catch (Exception ex) { WebInfoPublish.PublishInfo(this, "$Error_UpLoadFile_Exception", this.languageComponent1); return(false); } }
protected override void DeleteDomainObjects(ArrayList domainObjects) { WarehouseFacade _WarehouseFacade = new WarehouseFacade(base.DataProvider); InventoryFacade _InventoryFacade = new InventoryFacade(this.DataProvider); object objStorloctrans = _WarehouseFacade.GetStorloctrans(txtTransNoQuery.Text); Storloctrans storloctrans = objStorloctrans as Storloctrans; if (storloctrans == null) { WebInfoPublish.Publish(this, txtTransNoQuery.Text + "转储单不存在!", this.languageComponent1); return; } if (storloctrans.Status == "Close") { WebInfoPublish.Publish(this, "转储单已关闭不能删除!", this.languageComponent1); return; } ArrayList array = this.gridHelper.GetCheckedRows(); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); int mDate = dbDateTime.DBDate; int mTime = dbDateTime.DBTime; foreach (GridRecord row in array) { string transno = storloctrans.Transno; string fromCartonno = row.Items.FindItemByKey("FCartonNo").Text; string cartonno = row.Items.FindItemByKey("TCartonNo").Text; StorloctransDetailCarton storCartonno = (StorloctransDetailCarton)_WarehouseFacade.GetStorloctransdetailcarton(transno, fromCartonno, cartonno); if (storCartonno != null) { _WarehouseFacade.DeleteStorloctransdetailcarton(storCartonno); StorageDetail stor = (StorageDetail)_WarehouseFacade.GetStorageDetail(fromCartonno); if (stor != null) { stor.FreezeQty = stor.FreezeQty - (int)storCartonno.Qty; stor.AvailableQty = stor.AvailableQty + (int)storCartonno.Qty; _WarehouseFacade.UpdateStorageDetail(stor); } object[] objs = _WarehouseFacade.GetStorageDetailSnbyCartonNoBlock(fromCartonno); if (objs != null && objs.Length > 0) { foreach (StorageDetailSN storageDetailSN in objs) { storageDetailSN.PickBlock = "N"; storageDetailSN.MaintainUser = GetUserCode(); storageDetailSN.MaintainDate = mDate; storageDetailSN.MaintainTime = mTime; _InventoryFacade.UpdateStorageDetailSN(storageDetailSN); } } StorloctransDetailSN[] storSns = _WarehouseFacade.GetStorloctransDetailSNs(transno, fromCartonno); foreach (StorloctransDetailSN sn in storSns) { _WarehouseFacade.DeleteStorloctransdetailsn(sn); } if (storCartonno.Qty != 0) { StorloctransDetail cartonnoDetail = (StorloctransDetail)_WarehouseFacade.GetStorloctransdetail(transno, storCartonno.MCode); if (cartonnoDetail != null) { cartonnoDetail.Status = "Pick"; cartonnoDetail.MaintainUser = GetUserCode(); cartonnoDetail.MaintainDate = mDate; cartonnoDetail.MaintainTime = mTime; _WarehouseFacade.UpdateStorloctransdetail(cartonnoDetail); } } } } }
protected void cmdSave_ServerClick(object sender, System.EventArgs e) { if (!SaveCheck()) { return; } AlertErrorCode alertError = new AlertErrorCode(); alertError.ItemSequence = this.txtAlertItemSequence.Text; alertError.ItemType = this.ddlItemType.SelectedValue; alertError.ErrorCauseCode = this.txtErrorCode.Text; alertError.TimeDimension = this.rblTimeDimensionGroup.SelectedValue; //是否区分线别 if (this.chbLineDivision.Checked) { alertError.LineDivision = "Y"; } else { alertError.LineDivision = "N"; } //产生预警通告 if (this.chbGenerateNotice.Checked) { alertError.GenerateNotice = "Y"; } else { alertError.GenerateNotice = "N"; } //发送邮件 if (this.chbSendMail.Checked) { int count = this._AlertFacade.QueryAlertMailSettingsCount(alertError.ItemSequence); if (count > 0) { alertError.SendMail = "Y"; } else { WebInfoPublish.Publish(this, "$Error_EmailSetup_Need", this._LanguageComponent1); return; } } else { alertError.SendMail = "N"; } //停线控制 if (this.chbLinePause.Checked) { alertError.LinePause = "Y"; } else { alertError.LinePause = "N"; } alertError.AlertValue = int.Parse(this.txtAlertStandard.Text); alertError.MaintainDate = FormatHelper.TODateInt(DateTime.Now.ToShortDateString()); alertError.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now); alertError.MaintainUser = this.GetUserCode(); this._AlertFacade.SaveAlertErrorCode(alertError); WebInfoPublish.Publish(this, "$CS_Save_Success", this._LanguageComponent1); }
protected override void DeleteDomainObjects(ArrayList domainObjects) { if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(base.DataProvider); } if (_InventoryFacade == null) { _InventoryFacade = new InventoryFacade(this.DataProvider); } Pickdetailmaterialsn[] pickdetailmaterialList = ((Pickdetailmaterialsn[])domainObjects.ToArray(typeof(Pickdetailmaterialsn))); try { this.DataProvider.BeginTransaction(); foreach (Pickdetailmaterialsn pickdetailm in pickdetailmaterialList) { #region delete //请先删除箱单信息 string sn = pickdetailm.Sn; object[] list = _WarehouseFacade.GetCartoninvdetailsnBySn(sn); if (list != null) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "请先删除箱单信息", this.languageComponent1); return; } #region delete 检查 //1、只有行明细是拣料中和拣料完成状态,且拣货任务令头状态是拣料状态或制作箱单状态时才可以删除。 PickDetail pickDetail = _InventoryFacade.GetPickDetail(pickdetailm.Pickno, pickdetailm.Pickline) as PickDetail; Pick pickHead = _InventoryFacade.GetPick(pickdetailm.Pickno) as Pick; if (pickDetail == null || pickHead == null) { this.DataProvider.RollbackTransaction(); return; } if (!(pickDetail.Status == PickDetail_STATUS.Status_Pick || pickDetail.Status == PickDetail_STATUS.Status_WaitPick || pickDetail.Status == PickDetail_STATUS.Status_ClosePick || pickDetail.Status == PickDetail_STATUS.Status_Cancel)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "行明细是拣料中和拣料完成,取消状态,才可以删除", this.languageComponent1); return; } if (!(pickHead.Status == PickHeadStatus.PickHeadStatus_Pick || pickDetail.Status == PickDetail_STATUS.Status_WaitPick || pickHead.Status == PickHeadStatus.PickHeadStatus_MakePackingList || pickHead.Status == PickHeadStatus.PickHeadStatus_Cancel)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "拣货任务令头状态是拣料状态或制作箱单,取消状态时,才可以删除", this.languageComponent1); return; } //delete pickdetailmsn _WarehouseFacade.DeletePickdetailmaterialsn(pickdetailm); // tblPickdetailmaterial object[] snlist = _WarehouseFacade.QueryPickdetailmaterialsnByCartonno(pickdetailm.Pickno, pickdetailm.Cartonno); Pickdetailmaterial pickdetailmaterial = _WarehouseFacade.GetPickdetailmaterial(pickdetailm.Pickno, pickdetailm.Cartonno) as Pickdetailmaterial; if (pickdetailmaterial != null) { pickdetailmaterial.Qty -= 1; _WarehouseFacade.UpdatePickdetailmaterial(pickdetailmaterial); if (snlist == null) { _WarehouseFacade.DeletePickdetailmaterial(pickdetailmaterial); } } //3、所有已拣行明细删除后,拣货任务令状态变更为待拣料。 #endregion StorageDetail storageDetail = _WarehouseFacade.GetStorageDetail(pickdetailm.Cartonno) as StorageDetail; if (storageDetail != null) { storageDetail.FreezeQty -= 1; storageDetail.AvailableQty += 1; _WarehouseFacade.UpdateStorageDetail(storageDetail); } StorageDetailSN storageDetailsn = _InventoryFacade.GetStorageDetailSN(pickdetailm.Sn) as StorageDetailSN; if (storageDetailsn != null) { storageDetailsn.PickBlock = "N"; _InventoryFacade.UpdateStorageDetailSN(storageDetailsn); } int count = _WarehouseFacade.GetPickdetailmaterialCount(pickdetailm.Pickno); pickDetail.SQTY -= 1; if (pickDetail.Status != "Cancel") { pickDetail.Status = PickDetail_STATUS.Status_Pick; } if (count == 0) { //pickHead.Status = PickHeadStatus.PickHeadStatus_WaitPick; _WarehouseFacade.UpdatePick(pickHead); //pickDetail.Status = PickDetail_STATUS.Status_WaitPick; } _WarehouseFacade.UpdatePickdetail(pickDetail); #endregion } this.DataProvider.CommitTransaction(); WebInfoPublish.Publish(this, "删除成功", this.languageComponent1); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1); } }
protected override void AddDomainObject(object domainObject) { if (_RMAFacade == null) { _RMAFacade = new BenQGuru.eMES.MOModel.RMAFacade(base.DataProvider); } //已经关闭或结案的RMA不能新增行项目 string RMABillCode = this.txtRMABillCode.Text.Trim(); object obj = _RMAFacade.GetRMABill(RMABillCode); if (((RMABill)obj).Status == RMABillStatus.Closed) { WebInfoPublish.Publish(this, "$BS_RMABillStatus_IsClose_CannotAdd", this.languageComponent1); return; } if (((RMABill)obj).Status == RMABillStatus.Opened) { WebInfoPublish.Publish(this, "$BS_RMABillStatus_IsOpened_CannotAdd", this.languageComponent1); return; } //新增前唯一性检查 string rcard = FormatHelper.CleanString(this.txtRCardEdit.Text).ToUpper(); if (_DataCollectFacade == null) { _DataCollectFacade = new BenQGuru.eMES.DataCollect.DataCollectFacade(this.DataProvider); } object objSim = _DataCollectFacade.GetLastSimulationReport(rcard); //if (objSim == null) //{ // WebInfoPublish.Publish(this, "$BS_RCARD_NOT_EXIST", this.languageComponent1); // return; //} if (objSim != null && (objSim as Domain.DataCollect.SimulationReport).IsComplete != "1") { WebInfoPublish.Publish(this, "$BS_RCARD_IS_NOT_COMPLETE", this.languageComponent1); return; } object objExist = this._RMAFacade.GetRMADetailByRCard(rcard); if (objExist != null) { WebInfoPublish.Publish(this, "$BS_ALREADY_RMABillDetial", this.languageComponent1); return; } DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); ((RMADetial)domainObject).Mdate = dbDateTime.DBDate; ((RMADetial)domainObject).Mtime = dbDateTime.DBTime; ((RMADetial)domainObject).MaintainUser = this.GetUserCode(); this._RMAFacade.AddRMADetial((RMADetial)domainObject); }
private object[] LoadDataSource(int inclusive, int exclusive) { /* modified by jessie lee, 2005/12/8 * CS187 工单的查询结果栏位增加“导入日期”栏位。 * 工单的查询条件增加“导入日期过滤”开关项,打开后,导入起始日期默认为10天前,导入结束日期默认为当天。 * 执行查询,依据导入日期的范围对工单记录进行过滤。 */ if (this.chbImportDate.Checked) { PageCheckManager manager = new PageCheckManager(); manager.Add(new DateRangeCheck(this.lblEnterDate, this.ImportDateFrom.Text, this.ImportDateTo.Text, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(null); } } if (this.chbUseDate.Checked) { PageCheckManager manager = new PageCheckManager(); manager.Add(new DateRangeCheck(this.lblInDateFromQuery, this.dateInDateFromQuery.Text, this.dateInDateToQuery.Text, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(null); } } if (this.txtActstarDateFrom.Text.Trim() != string.Empty) { PageCheckManager manager = new PageCheckManager(); manager.Add(new LengthCheck(this.lblActstarDateFrom, this.txtActstarDateFrom, 5, false)); manager.Add(new NumberCheck(this.lblActstarDateFrom, this.txtActstarDateFrom, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(null); } } if (this.txtActstarDateTo.Text.Trim() != string.Empty) { PageCheckManager manager = new PageCheckManager(); manager.Add(new LengthCheck(this.lblActstarDateTo, this.txtActstarDateTo, 5, false)); manager.Add(new NumberCheck(this.lblActstarDateTo, this.txtActstarDateTo, false)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(null); } } if (this.txtActstarDateFrom.Text.Trim() != string.Empty && this.txtActstarDateTo.Text.Trim() != string.Empty) { if (Convert.ToInt32(this.txtActstarDateTo.Text.Trim()) - Convert.ToInt32(this.txtActstarDateFrom.Text.Trim()) < 0) { WebInfoPublish.Publish(this, "$CS_ActstarDate_Must_Over_Zero", this.languageComponent1); return(null); } } int ActstarDateFrom = 0; if (this.txtActstarDateTo.Text.Trim() != string.Empty) { ActstarDateFrom = FormatHelper.TODateInt(DateTime.Now.Date.AddDays(-Convert.ToInt32(this.txtActstarDateTo.Text.Trim()))); } int ActstarDateTo = 0; if (this.txtActstarDateFrom.Text.Trim() != string.Empty && Convert.ToInt32(this.txtActstarDateFrom.Text.Trim()) != 0) { ActstarDateTo = FormatHelper.TODateInt(DateTime.Now.Date.AddDays(-Convert.ToInt32(this.txtActstarDateFrom.Text.Trim()))); } if (_facade == null) { _facade = new MOFacade(this.DataProvider); } if (this.chbImportDate.Checked && this.chbUseDate.Checked) { return(this._facade.QueryMOIllegibility( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), FormatHelper.TODateInt(this.dateInDateFromQuery.Text), FormatHelper.TODateInt(this.dateInDateToQuery.Text), FormatHelper.TODateInt(this.ImportDateFrom.Text), FormatHelper.TODateInt(this.ImportDateTo.Text), ActstarDateFrom, ActstarDateTo, inclusive, exclusive)); } else if (this.chbImportDate.Checked && !this.chbUseDate.Checked) { return(this._facade.QueryMOIllegibility( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), 0, 0, FormatHelper.TODateInt(this.ImportDateFrom.Text), FormatHelper.TODateInt(this.ImportDateTo.Text), ActstarDateFrom, ActstarDateTo, inclusive, exclusive)); } else if (!this.chbImportDate.Checked && this.chbUseDate.Checked) { return(this._facade.QueryMOIllegibility( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), FormatHelper.TODateInt(this.dateInDateFromQuery.Text), FormatHelper.TODateInt(this.dateInDateToQuery.Text), 0, 0, ActstarDateFrom, ActstarDateTo, inclusive, exclusive)); } return(this._facade.QueryMOIllegibility( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMoCodeQuery.Text)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeQuery.Text)), FormatHelper.CleanString(this.txtItemDescription.Text), FormatHelper.CleanString(this.drpMoTypeQuery.SelectedValue), FormatHelper.CleanString(this.drpMoStatusQuery.SelectedValue), string.Empty, FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtFactoryQuery.Text)), 0, 0, 0, 0, ActstarDateFrom, ActstarDateTo, inclusive, exclusive)); }
//软件出库 protected void cmdSoftwareOut_ServerClick(object sender, EventArgs e) { if (facade == null) { facade = new InventoryFacade(base.DataProvider); } if (gridWebGrid.Rows.Count <= 0) { WebInfoPublish.Publish(this, "Gird数据不能为空", this.languageComponent1); return; } Dictionary <string, string> dnBatchNoList = new Dictionary <string, string>(); try { this.DataProvider.BeginTransaction(); #region 出库 #region dnBatchNo for (int i = 0; i < this.gridWebGrid.Rows.Count; i++) { //string InvNo = this.gridWebGrid.Rows[i].Items.FindItemByKey("INVNO").Value.ToString(); //string InvLine = this.gridWebGrid.Rows[i].Items.FindItemByKey("INVLINE").Value.ToString(); string dnBatchNo = this.gridWebGrid.Rows[i].Items.FindItemByKey("DNBatchNo").Value.ToString(); string movementtype = this.gridWebGrid.Rows[i].Items.FindItemByKey("MOVEMENTTYPE").Value.ToString(); //判断发货批号不能为空。 #region check if (string.IsNullOrEmpty(dnBatchNo)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, "发货批号不能为空", this.languageComponent1); return; } if (!string.IsNullOrEmpty(movementtype)) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, "所有物料移动类型必须全为空", this.languageComponent1); return; } #endregion if (!dnBatchNoList.ContainsKey(dnBatchNo)) { dnBatchNoList.Add(dnBatchNo, dnBatchNo); } //dnBatchNoList.Add(dnBatchNo); } #endregion if (dnBatchNoList.Count > 1) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, "软件不允许多个DN批次号出库", this.languageComponent1); return; } //回写当前整个发货批中的所有DN if (dnBatchNoList.Count > 0) { foreach (string dnbatchNo in dnBatchNoList.Keys) { BenQGuru.eMES.Material.InvoicesDetailEx[] ins = facade.GetDNInVoicesDetails(dnbatchNo); Dictionary <string, List <BenQGuru.eMES.SAPRFCService.Domain.DN> > dnsOk = new Dictionary <string, List <BenQGuru.eMES.SAPRFCService.Domain.DN> >(); if (ins.Length == 0) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, "此单已被取消", this.languageComponent1); return; } #region dnsOk foreach (BenQGuru.eMES.Material.InvoicesDetailEx inv in ins) { if (string.IsNullOrEmpty(inv.MovementType)) { #region BenQGuru.eMES.SAPRFCService.Domain.DN dn = new BenQGuru.eMES.SAPRFCService.Domain.DN(); dn.DNNO = inv.InvNo; dn.DNLine = inv.InvLine; dn.BatchNO = dnbatchNo; dn.Unit = inv.Unit; if (dnsOk.ContainsKey(inv.InvNo)) { dnsOk[inv.InvNo].Add(dn); } else { dnsOk[inv.InvNo] = new List <BenQGuru.eMES.SAPRFCService.Domain.DN>(); dnsOk[inv.InvNo].Add(dn); } #endregion } else { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, "所有物料移动类型必须全为空", this.languageComponent1); return; } } #endregion #region SAP回写 foreach (string key in dnsOk.Keys) { if (dnsOk[key].Count > 0) { BenQGuru.eMES.SAPRFCService.Domain.SAPRfcReturn ok = SendDNToSap(dnsOk[key], true); LogDN(dnsOk[key], ok, "Y"); if (ok == null) { throw new SAPException(key + "SAP回写返回空:"); } if (string.IsNullOrEmpty(ok.Result)) { throw new SAPException(key + "SAP回写失败 值:" + ok.Result + ":" + ok.Message); } if (ok.Result.ToUpper().Trim() != "S") { throw new SAPException(key + "SAP回写失败 值:" + ok.Result + ok.Message); } BenQGuru.eMES.Common.Log.Error("---------------------" + ok.Result + ":" + ok.Message + "---------------"); } else { throw new SAPException(key + "项目为空!"); } } #endregion } } #endregion this.DataProvider.CommitTransaction(); WebInfoPublish.Publish(this, "软件出库成功", this.languageComponent1); } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.PublishInfo(this, ex.Message, this.languageComponent1); } }
protected override void Grid_ClickCell(GridRecord row, string commandName) { try { if (commandName == "Docname") { if (_documentFacade == null) { _documentFacade = new DocumentFacade(this.DataProvider); } bool right = _documentFacade.GetDocDirRight(int.Parse(row.Items.FindItemByKey("Dirserial").Value.ToString()), this.GetUserCode(), "QUERY"); Doc doc = _documentFacade.GetDOC(int.Parse(row.Items.FindItemByKey("Docserial").Value.ToString())) as Doc; if (right) { if (doc.Checkedstatus == "Y" && doc.Validstatus == "Y") { if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } //object parameter = _facade.GetParameter("DOCDIRPATH", "DOCDIRPATHGROUP"); //if (parameter != null) //{ //服务器目录路径 //string filePath = ((Domain.BaseSetting.Parameter)parameter).ParameterAlias; string filePath = System.AppDomain.CurrentDomain.BaseDirectory + "FileUpload"; if (filePath.LastIndexOf('\\') == filePath.Length - 1) { filePath = filePath.Substring(0, filePath.Length - 1); } #region//下载文件 FileInfo currentFile = new FileInfo(filePath + "/" + row.Items.FindItemByKey("ServerFullName").Value.ToString()); if (currentFile.Exists) { this.DownloadFileFull(this.VirtualHostRoot + "FileUpload/" + row.Items.FindItemByKey("ServerFullName").Value.ToString()); } else { WebInfoPublish.PublishInfo(this, "$Error_QueryFile_NotExist", this.languageComponent1); } #endregion //} //else //{ // WebInfoPublish.PublishInfo(this, "$Error_DocDirPath_NotExist", this.languageComponent1); //} } else { WebInfoPublish.PublishInfo(this, "$Error_FileIsNotCheckedOrValid", this.languageComponent1); } } else { WebInfoPublish.PublishInfo(this, "$Error_HaveNoRightToDownload", this.languageComponent1); } } } catch (Exception ex) { WebInfoPublish.PublishInfo(this, "$Error_QueryFile_Exception", this.languageComponent1); } }
protected override void DoQuery() { base.DoQuery(); if (this.CheckBeforeQuery()) { this.AutoRefresh = this.chbRefreshAuto.Checked; string compareType = this.UCGroupConditions1.UserSelectCompareType.Trim().ToLower(); string byTimeType = this.UCGroupConditions1.UserSelectByTimeType.Trim().ToLower(); string inputOutput = this.UCWhereConditions1.UserSelectInputOutput.Trim().ToLower(); object[] dateSource = null; object[] dateSourceCompare = null; //一般数据 dateSource = this.LoadDataSource(false, compareType.Trim().Length > 0); //((NewReportDomainObject)dateSource[0]).YR=((NewReportDomainObject)dateSource[0]).YR *100%; if (dateSource == null || dateSource.Length <= 0) { this.gridWebGrid.Visible = false; this.cmdGridExport.Visible = false; ReportPageHelper.SetPageScrollToBottom(this); return; } //环比/同期比数据 if (compareType.Trim().Length > 0) { dateSourceCompare = this.LoadDataSource(true, true); } if (dateSourceCompare == null) { dateSourceCompare = new NewReportDomainObject[0] { }; } //获得查询的工序 string parameterGroupCode = string.Empty; if (UCWhereConditions1.UserSelectGoodSemiGood.Trim() == ItemType.ITEMTYPE_FINISHEDPRODUCT) { parameterGroupCode = "FINISHEDSTR"; } if (UCWhereConditions1.UserSelectGoodSemiGood.Trim() == ItemType.ITEMTYPE_SEMIMANUFACTURE) { parameterGroupCode = "SEMIFINISHEDSTR"; } SystemSettingFacade systemSettingFacade = new SystemSettingFacade(this.DataProvider); Object[] parameterList = systemSettingFacade.GetAllParametersOrderByEattribute1(parameterGroupCode); if (parameterList == null) { WebInfoPublish.Publish(this.Page, "$BS_Pelease_Maintenance_QueryOP", this.languageComponent1); return; } List <string> fixedHeadOPList = new List <string>(); List <string> fixedHeadOPDescList = new List <string>(); foreach (eMES.Domain.BaseSetting.Parameter parameter in parameterList) { fixedHeadOPList.Add(parameter.ParameterAlias); fixedHeadOPDescList.Add(parameter.ParameterDescription); } fixedHeadOPDescList.Add("直通率"); //数据加载到Grid List <string> fixedColumnList = GetRows(); fixedColumnList = OrderfixedColumnList(fixedColumnList); if (byTimeType == NewReportByTimeType.ShiftDay) { fixedColumnList.Add("ShiftDay"); } if (byTimeType == NewReportByTimeType.Week) { fixedColumnList.Add("Week"); } if (byTimeType == NewReportByTimeType.Month) { fixedColumnList.Add("Month"); } if (byTimeType == NewReportByTimeType.Year) { fixedColumnList.Add("Year"); } List <ReportGridDim3Property> dim3PropertyList = new List <ReportGridDim3Property>(); ReportGridHelperNew reportGridHelper = new ReportGridHelperNew(this.DataProvider, this.languageComponent1, this.gridWebGrid, this.DtSource); reportGridHelper.DataSource = dateSource; reportGridHelper.DataSourceForCompare = dateSourceCompare; reportGridHelper.Dim1PropertyList = fixedColumnList; reportGridHelper.Dim3PropertyList = dim3PropertyList; reportGridHelper.FixedHeadDefaultValueList = fixedHeadOPList; reportGridHelper.FixedHeadDescDefaultValueList = fixedHeadOPDescList; reportGridHelper.HasDim3PropertyNameRowColumn = true; reportGridHelper.CompareType = compareType; reportGridHelper.ByTimeType = byTimeType; reportGridHelper.ShowGridWithFixedOPHead(); base.InitWebGrid(); this.gridWebGrid.Behaviors.RowSelectors.RowNumbering = false; this.gridWebGrid.Behaviors.Sorting.Enabled = false; //获取表格和图示 if (UCDisplayConditions1.GetDisplayType().Trim().ToLower() == NewReportDisplayType.Grid) { this.gridWebGrid.Visible = true; this.cmdGridExport.Visible = true; } ReportPageHelper.SetPageScrollToBottom(this); } else { this.chbRefreshAuto.Checked = false; this.AutoRefresh = false; } }
protected override bool ValidateInput() { PageCheckManager manager = new PageCheckManager(); manager.Add(new DateCheck(this.lblDate, this.dateDateFrom.Text, true)); manager.Add(new LengthCheck(lblBigSSCodeGroup, txtBigSSCodeGroup, 40, true)); manager.Add(new LengthCheck(lblMOEdit, txtMOEdit, 40, true)); manager.Add(new LengthCheck(lblMactureSeq, txtMactureSeq, 10, true)); manager.Add(new LengthCheck(lblMOSeqEdit, txtMOSeqEdit, 10, true)); manager.Add(new DecimalCheck(lblPlanInQTYEdit, txtPlanInQTYEdit, 0, 9999999999, true)); manager.Add(new TimeRangeCheck(this.lblPlanInStartDateEdit, this.timeFrom.Text, this.timeFrom.Text, true)); if (this.txtMOSeqEdit.Text.Trim().Length > 0) { manager.Add(new NumberCheck(lblMOSeqEdit, txtMOSeqEdit, 0, 9999999999, true)); } if (this.txtMactureSeq.Text.Trim().Length > 0) { manager.Add(new NumberCheck(lblMactureSeq, txtMactureSeq, 0, 9999999999, true)); } if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(false); } if (_MoFacade == null) { _MoFacade = new MOFacade(base.DataProvider); } object objMo = _MoFacade.GetMO(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOEdit.Text))); if (objMo == null) { WebInfoPublish.Publish(this, "$CS_MO_Not_Exist", languageComponent1); return(false); } if (_Facade == null) { _Facade = new MaterialFacade(base.DataProvider); } ShiftModelFacade shiftModelFacade = new ShiftModelFacade(base.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(base.DataProvider); WorkPlan GetWorkPlanByKeys = (WorkPlan)_Facade.GetWorkPlan(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)), FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)), FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtMOEdit.Text)), int.Parse(FormatHelper.CleanString(this.txtMOSeqEdit.Text))); WorkPlan GetWorkPlanByUnipues = (WorkPlan)_Facade.GetWorkPlan(FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)), FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)), int.Parse(FormatHelper.CleanString(this.txtMactureSeq.Text))); if (GetWorkPlanByKeys == null && GetWorkPlanByUnipues != null) { WebInfoPublish.PublishInfo(this, "$date__isunique", languageComponent1); return(false); } if (GetWorkPlanByKeys != null && GetWorkPlanByUnipues != null) { if (GetWorkPlanByKeys.BigSSCode != GetWorkPlanByUnipues.BigSSCode || GetWorkPlanByKeys.PlanDate != GetWorkPlanByUnipues.PlanDate || GetWorkPlanByKeys.MoCode != GetWorkPlanByUnipues.MoCode || GetWorkPlanByKeys.MoSeq != GetWorkPlanByUnipues.MoSeq) { WebInfoPublish.PublishInfo(this, "$date__isunique", languageComponent1); return(false); } } int shiftDay = shiftModelFacade.GetShiftDayByBigSSCode( FormatHelper.PKCapitalFormat(FormatHelper.CleanString(txtBigSSCodeGroup.Text)), dbDateTime.DateTime); if (FormatHelper.TODateInt(FormatHelper.CleanString(this.dateDateFrom.Date_String)) < shiftDay) { WebInfoPublish.PublishInfo(this, "$if_date_cannotmodify", languageComponent1); return(false); } return(true); }
protected void cmdImport_ServerClick(object sender, EventArgs e) { string fileName = FileLoadProcess.UploadFile2ServerUploadFolder(this.Page, this.fileInit, null); if (fileName == null) { WebInfoPublish.Publish(this, "$Error_UploadFileIsEmpty", this.languageComponent1); return; } if (!fileName.ToLower().EndsWith(".csv")) { WebInfoPublish.Publish(this, "$Error_UploadFileTypeError", this.languageComponent1); return; } if (items == null) { items = GetAllItem(fileName); if (items == null) { return; } } if (items == null || items.Length == 0) { return; } int successNum = 0; CultureInfo culture = new System.Globalization.CultureInfo("en-US"); string userCode = this.GetUserCode(); if (facade == null) { facade = new BaseModelFacade(this.DataProvider); } SoftWareVersion softWareVersion = this.facade.CreateNewSoftWareVersion(); ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = false; ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); DataProvider.BeginTransaction(); try { for (int i = 0; i < items.Length; i++) { #region Check string versionCode = GetFieldValue(items[i], "VersionCode"); if (versionCode == string.Empty) { WebInfoPublish.Publish(this, "软件版本不能为空", this.languageComponent1); return; } else { object obj = facade.GetSoftWareVersion(versionCode); if (obj != null) { WebInfoPublish.Publish(this, string.Format("软件版本:{0} 已经存在", versionCode), this.languageComponent1); return; } } if (Encoding.Default.GetByteCount(versionCode) > 40) { WebInfoPublish.Publish(this, "软件版本长度超出范围,最大长度40字节", this.languageComponent1); return; } string effectiveDate = GetFieldValue(items[i], "EffectiveDate"); if (effectiveDate == string.Empty) { WebInfoPublish.Publish(this, "生效日期不能为空", this.languageComponent1); return; } else { try { DateTime endDate = DateTime.ParseExact(effectiveDate, "yyyyMMdd", culture); } catch { WebInfoPublish.Publish(this, "生效日期格式不正确", this.languageComponent1); return; } } string invalidDate = GetFieldValue(items[i], "InvalidDate"); if (invalidDate == string.Empty) { WebInfoPublish.Publish(this, "失效日期不能为空", this.languageComponent1); return; } else { try { DateTime endDate = DateTime.ParseExact(invalidDate, "yyyyMMdd", culture); } catch { WebInfoPublish.Publish(this, "失效日期格式不正确", this.languageComponent1); return; } } #endregion softWareVersion.VersionCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(versionCode)); softWareVersion.Status = SoftWareVersionStatus.Valid; softWareVersion.EffectiveDate = int.Parse(effectiveDate); softWareVersion.InvalidDate = int.Parse(invalidDate); softWareVersion.MaintainUser = userCode; softWareVersion.OrganizationID = GlobalVariables.CurrentOrganizations.First().OrganizationID; this.facade.AddSoftWareVersion(softWareVersion); successNum++; } this.DataProvider.CommitTransaction(); string strMessage = "导入:" + successNum + "笔"; WebInfoPublish.Publish(this, strMessage, this.languageComponent1); items = null; } catch (Exception ex) { this.DataProvider.RollbackTransaction(); WebInfoPublish.Publish(this, ex.Message, this.languageComponent1); return; } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.AutoCloseConnection = true; } }
private void DownloadIQCXlsFile(List <IQCHeadWithVendor> headList) { if (headList.Count <= 0) { return; } UserFacade userFacade = new UserFacade(this.DataProvider); DBDateTime dbDateTime = FormatHelper.GetNowDBDateTime(this.DataProvider); //获取下载模板及Workbook节点和Worksheet节点 string templateFilePath = GetTemplateFilePath(); if (templateFilePath.Trim().Length <= 0) { WebInfoPublish.PublishInfo(this, "文件[IQCTemplate.xml]不存在", languageComponent1); return; } XmlDocument template = new XmlDocument(); template.Load(templateFilePath); XmlNode workbook = null; XmlNode worksheet = null; workbook = GetChildNode(template, "Workbook", 1); if (workbook == null) { WebInfoPublish.PublishInfo(this, "文件[IQCTemplate.xml]内容不正确", languageComponent1); return; } worksheet = GetChildNode(workbook, "Worksheet", 1); if (worksheet == null) { WebInfoPublish.PublishInfo(this, "文件[IQCTemplate.xml]内容不正确", languageComponent1); return; } //处理每个IQCHead为一个Worksheet foreach (IQCHeadWithVendor iqcHead in headList) { XmlNode newWorksheet = worksheet.Clone(); StringBuilder newInnerXml = new StringBuilder(newWorksheet.InnerXml); //表头数据和表尾数据 User appUser = (User)userFacade.GetUser(iqcHead.Applicant); User invUser = (User)userFacade.GetUser(iqcHead.InventoryUser); newInnerXml.Replace("$$IQCNo$$", CommonHelper.ConvertXML(iqcHead.IQCNo)); newInnerXml.Replace("$$ASN$$", CommonHelper.ConvertXML(iqcHead.STNo)); newInnerXml.Replace("$$PrintDate$$", CommonHelper.ConvertXML(FormatHelper.ToDateString(dbDateTime.DBDate))); newInnerXml.Replace("$$PrintTime$$", CommonHelper.ConvertXML(FormatHelper.ToTimeString(dbDateTime.DBTime))); newInnerXml.Replace("$$IQCStatus$$", CommonHelper.ConvertXML(this.languageComponent1.GetString(iqcHead.Status))); newInnerXml.Replace("$$VendorCode$$", CommonHelper.ConvertXML(iqcHead.VendorCode)); newInnerXml.Replace("$$VendorName$$", CommonHelper.ConvertXML(iqcHead.VendorName)); newInnerXml.Replace("$$Storage$$", CommonHelper.ConvertXML(iqcHead.StorageCode + "-" + iqcHead.StorageName)); newInnerXml.Replace("$$AppUserName$$", appUser == null ? CommonHelper.ConvertXML(iqcHead.Applicant) : CommonHelper.ConvertXML(appUser.UserName)); newInnerXml.Replace("$$AppDateTime$$", CommonHelper.ConvertXML(FormatHelper.ToDateString(iqcHead.AppDate) + " " + FormatHelper.ToTimeString(iqcHead.AppTime))); newInnerXml.Replace("$$InventoryUserName$$", invUser == null ? CommonHelper.ConvertXML(iqcHead.InventoryUser) : CommonHelper.ConvertXML(invUser.UserName)); newInnerXml.Replace("$$IQCHeadAttribute$$", CommonHelper.ConvertXML(this.languageComponent1.GetString(iqcHead.Attribute))); newInnerXml.Replace("$$ShipToStock$$", iqcHead.STS == "Y" ? CommonHelper.ConvertXML(this.languageComponent1.GetString("ShipToStock")) : string.Empty); newInnerXml.Replace("$$ROHS$$", iqcHead.ROHS == "Y" ? "ROHS" : string.Empty); newWorksheet.InnerXml = newInnerXml.ToString(); //获取行数据 object[] iqcDetailList = _IQCFacade.QueryIQCDetailWithMaterial(iqcHead.IQCNo, string.Empty, IQCStatus.IQCStatus_Cancel, int.MinValue, int.MaxValue); if (iqcDetailList == null) { iqcDetailList = new object[0]; } //获取行模板 List <XmlNode> rowTemplateList = new List <XmlNode>(); XmlNode firstTable = GetChildNode(newWorksheet, "Table", 1); foreach (XmlNode node in firstTable.ChildNodes) { if (node.Name == "Row") { rowTemplateList.Add(node); } } int ticketCount = 0; for (int i = 0; i < iqcDetailList.Length; i++) { if (i % 10 == 0) { foreach (XmlNode node in rowTemplateList) { XmlNode newNode = node.CloneNode(true); if (newNode.Attributes.GetNamedItem("detailLineNo") != null) { int detailLineNo = int.Parse(node.Attributes.GetNamedItem("detailLineNo").Value); IQCDetailWithMaterial detial = null; if (ticketCount * 10 + detailLineNo < iqcDetailList.Length) { detial = (IQCDetailWithMaterial)iqcDetailList[ticketCount * 10 + detailLineNo]; } StringBuilder lineInnerXml = new StringBuilder(newNode.InnerXml); lineInnerXml.Replace("$$IQCLine$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.STLine.ToString())); lineInnerXml.Replace("$$MaterialCode$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.ItemCode)); lineInnerXml.Replace("$$MaterialDesc$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.MaterialDescription)); lineInnerXml.Replace("$$Unit$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.Unit)); lineInnerXml.Replace("$$ReceiveQty$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.ReceiveQty.ToString("0.00"))); lineInnerXml.Replace("$$OrderNo$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.OrderNo)); lineInnerXml.Replace("$$OrderLine$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.OrderLine.ToString())); lineInnerXml.Replace("$$IQCDetailAttribute$$", detial == null ? string.Empty : CommonHelper.ConvertXML(this.languageComponent1.GetString(detial.Attribute))); lineInnerXml.Replace("$$Memo$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.InvreceiptDetailMemo.ToString())); lineInnerXml.Replace("$$VenderLotNo$$", detial == null ? string.Empty : CommonHelper.ConvertXML(detial.VenderLotNo.ToString())); newNode.InnerXml = lineInnerXml.ToString(); } firstTable.AppendChild(newNode); } ticketCount++; } } firstTable.Attributes.GetNamedItem("ss:ExpandedRowCount").Value = Convert.ToString(ticketCount * rowTemplateList.Count); foreach (XmlNode node in rowTemplateList) { firstTable.RemoveChild(node); } newWorksheet.Attributes.GetNamedItem("ss:Name").Value = iqcHead.IQCNo.Trim(); workbook.AppendChild(newWorksheet); } //保存新生成的xls workbook.RemoveChild(worksheet); string filename = string.Empty; template.Save(GetOutputFilePath(out filename)); //下载xls文件 this.DownloadFile(filename); }
protected override bool ValidateInput() { ReworkFacade reworkFacade = new ReworkFacade(this.DataProvider); PageCheckManager manager = new PageCheckManager(); manager.Add(new LengthCheck(this.lblResourceCodeEdit, this.txtResourceCodeEdit, 40, true)); manager.Add(new LengthCheck(this.lblResourceDescriptionEdit, this.txtResourceDescriptionEdit, 100, false)); manager.Add(new LengthCheck(this.lblOrgIDEdit, this.DropDownListOrg, 8, true)); if (!manager.Check()) { WebInfoPublish.Publish(this, manager.CheckMessage, this.languageComponent1); return(false); } if (this.txtReworkRoute.Text.Trim().Length != 0) { object route = (new BaseModelFacade(this.DataProvider)).GetRoute(this.txtReworkRoute.Text.Trim().ToUpper()); if (route == null) { WebInfoPublish.Publish(this, "$Error_RouteNotExist", this.languageComponent1); return(false); } object route2OP = (new BaseModelFacade(this.DataProvider)).GetOperationByRouteCode(this.txtReworkRoute.Text.Trim().ToUpper()); if (route2OP == null) { WebInfoPublish.Publish(this, "$Error_RouteHasNoOperations", this.languageComponent1); return(false); } } if (this.txtReworkMo.Text.Trim().Length > 0) { string[] reworkCodeList = this.txtReworkMo.Text.Trim().ToUpper().Split(','); if (reworkCodeList == null) { reworkCodeList = new string[0]; } //返工需求单必须都存在 string errorMessage = string.Empty; foreach (string reworkCode in reworkCodeList) { ReworkSheet reworkSheet = (ReworkSheet)reworkFacade.GetReworkSheet(reworkCode); if (reworkSheet == null) { errorMessage += "$Error_ReworkSheet_NotExist" + " : " + reworkCode + "\n"; } } if (errorMessage.Trim().Length > 0) { WebInfoPublish.Publish(this, errorMessage, this.languageComponent1); return(false); } //保证相同产品的多张返工需求单,只能有一张没有判退批(及LotNo不能重复) List <string> itemCodeAndLotNoList = new List <string>(); foreach (string reworkCode in reworkCodeList) { ReworkSheet reworkSheet = (ReworkSheet)reworkFacade.GetReworkSheet(reworkCode); string itemCodeAndLotNo = reworkSheet.ItemCode + "\t" + (reworkSheet.LotList == null ? string.Empty : reworkSheet.LotList); if (itemCodeAndLotNoList.Contains(itemCodeAndLotNo)) { WebInfoPublish.Publish(this, "$Error_Res2ReworkSheetPK", this.languageComponent1); return(false); } else { itemCodeAndLotNoList.Add(itemCodeAndLotNo); } } //保证所选择的ReworkSheet的Route一致,并且存在 string routeCode = GetRouteCodeFromReworkCodeList(this.txtReworkMo.Text.Trim().ToUpper()); if (routeCode.Trim().Length <= 0) { //返工需求单的返工途程不存在或者不一致 WebInfoPublish.Publish(this, "$Error_ReworkSheetsNewRouteNotSame", this.languageComponent1); return(false); } else { object route = (new BaseModelFacade(this.DataProvider)).GetRoute(routeCode); if (route == null) { WebInfoPublish.Publish(this, "$Error_RouteNotExist", this.languageComponent1); return(false); } object route2OP = (new BaseModelFacade(this.DataProvider)).GetOperationByRouteCode(routeCode); if (route2OP == null) { WebInfoPublish.Publish(this, "$Error_RouteHasNoOperations", this.languageComponent1); return(false); } } } return(true); }
protected void cmdIQCReceiveBatch_ServerClick(object sender, System.EventArgs e) { ArrayList array = this.gridHelper.GetCheckedRows(); if (array.Count > 0) { ArrayList items = new ArrayList(); ArrayList itemsFailed = new ArrayList(); foreach (UltraGridRow row in array) { MaterialReceive materialReceive = (MaterialReceive)this.GetEditObject(row); //检查入库库别(页面上输入的是tblstorage.sapstorage) string sapStorage = materialReceive.StorageID.Trim().ToUpper(); object[] storageList = this.InvFacade.QueryStorageByOrgId(materialReceive.OrganizationID, sapStorage); if (storageList == null) { //WebInfoPublish.Publish(this, "$INVALID_STORGE" + " " + "$PageControl_IQCNo" + ":" + materialReceive.IQCNo , languageComponent1); WebInfoPublish.Publish(this, string.Format("$INVALID_STORGE $PageControl_IQCNo:{0} $STLINE:{1}", materialReceive.IQCNo, materialReceive.STLine), languageComponent1); return; } string returnMessage = string.Empty; if (IQCReceive(materialReceive, ref returnMessage)) { items.Add(materialReceive); } else { itemsFailed.Add(materialReceive); materialReceive.ReceiveMemo = languageComponent1.GetString(returnMessage); } } this.gridHelper.GridBind(this.pagerToolBar.PageIndex, this.pagerToolBar.PageSize); this.RequestData(); this.buttonHelper.PageActionStatusHandle(PageActionType.Query); string message = string.Empty; if (items != null && items.Count > 0) { message += "$Message_IQCReceiveOK" + " : \n"; foreach (MaterialReceive item in items) { message += item.IQCNo + "," + item.STLine + "\n"; } } if (itemsFailed != null && itemsFailed.Count > 0) { if (message.Trim().Length > 0) { message += "\n"; } message += "$Message_IQCReceiveFailed" + " : \n"; foreach (MaterialReceive item in itemsFailed) { message += item.IQCNo + "," + item.STLine + ": " + item.ReceiveMemo + "\n"; } } if (message.Trim().Length > 0) { WebInfoPublish.PublishInfo(this, message, languageComponent1); } } }
protected void CmdConfirmOweQtyObjects(object[] pickList) { // 点击该按钮,初始TBLPICKDETAIL. OweQTY为空or零, //点击该按钮后保存TBLPICKDETAIL. OweQTY= TBLPICKDETAIL. SQTY //注:只有状态为:Owe:欠料的物料行可以执行此按钮,确认后该行更新状态为ClosePick:拣料完成 if (facade == null) { facade = new InventoryFacade(base.DataProvider); } if (_WarehouseFacade == null) { _WarehouseFacade = new WarehouseFacade(base.DataProvider); } DBDateTime dbTime = FormatHelper.GetNowDBDateTime(this.DataProvider); try { this.DataProvider.BeginTransaction(); foreach (PickDetail pickdetail in pickList) { if (pickdetail.Status == PickDetail_STATUS.Status_Owe) { if (pickdetail.OweQTY == 0 || string.IsNullOrEmpty(pickdetail.OweQTY.ToString())) { PickDetail oldpickdetail = (PickDetail)facade.GetPickDetail(pickdetail.PickNo, pickdetail.PickLine); oldpickdetail.OweQTY = oldpickdetail.SQTY; oldpickdetail.Status = PickDetail_STATUS.Status_ClosePick; facade.UpdatePickDetail(oldpickdetail); } else { WebInfoPublish.Publish(this, "已申请欠料发货!", this.languageComponent1); return; } } else { WebInfoPublish.Publish(this, "只有状态为欠料的物料行可以执行此按钮", this.languageComponent1); return; } } #region 在invinouttrans表中增加一条数据 箱单完成日期 WarehouseFacade wfacade = new WarehouseFacade(base.DataProvider); DBDateTime dbTime1 = FormatHelper.GetNowDBDateTime(this.DataProvider); foreach (PickDetail pickDetail in pickList) { Pick pick = facade.GetPick(pickDetail.PickNo) as Pick; InvInOutTrans trans = wfacade.CreateNewInvInOutTrans(); trans.CartonNO = string.Empty; trans.DqMCode = pickDetail.DQMCode; trans.FacCode = string.Empty; trans.FromFacCode = string.Empty; trans.FromStorageCode = string.Empty; trans.InvNO = pick.InvNo;//.InvNo; trans.InvType = pick.PickType; trans.LotNo = string.Empty; trans.MaintainDate = dbTime1.DBDate; trans.MaintainTime = dbTime1.DBTime; trans.MaintainUser = this.GetUserCode(); trans.MCode = pickDetail.MCode; trans.ProductionDate = 0; trans.Qty = pickDetail.QTY; trans.Serial = 0; trans.StorageAgeDate = 0; trans.StorageCode = string.Empty; trans.SupplierLotNo = string.Empty; trans.TransNO = pickDetail.PickNo; trans.TransType = "OUT"; trans.Unit = string.Empty; trans.ProcessType = "ClosePick"; wfacade.AddInvInOutTrans(trans); } #endregion string pickno = FormatHelper.CleanString(this.txtPickNoQuery.Text); bool isUpdatePick = facade.QueryPickDetailCount(pickno, PickDetail_STATUS.Status_ClosePick) == 0; if (isUpdatePick) { facade.UpdatePickStatusByPickno(pickno, PickHeadStatus.PickHeadStatus_MakePackingList); } #region 创建发货箱单 string carInvNo = string.Empty; object obj = _WarehouseFacade.GetCartonInvoices(pickno); if (obj == null) { CARTONINVOICES CartonH = _WarehouseFacade.CreateNewCartoninvoices(); object objLot = _WarehouseFacade.GetNewLotNO("K", dbTime.DBDate.ToString().Substring(2, 6).ToString()); Serialbook serbook = _WarehouseFacade.CreateNewSerialbook(); if (objLot == null) { #region CartonH.CARINVNO = "K" + dbTime.DBDate.ToString().Substring(2, 6).ToString() + "001"; CartonH.PICKNO = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPickNoQuery.Text)); CartonH.STATUS = CartonInvoices_STATUS.Status_Release; CartonH.CDATE = dbTime.DBDate; CartonH.CTIME = dbTime.DBTime; CartonH.CUSER = this.GetUserCode(); CartonH.MDATE = dbTime.DBDate; CartonH.MTIME = dbTime.DBTime; CartonH.MUSER = this.GetUserCode(); _WarehouseFacade.AddCartoninvoices(CartonH); serbook.SNprefix = "K" + dbTime.DBDate.ToString().Substring(2, 6).ToString(); serbook.MAXSerial = "2"; serbook.MUser = this.GetUserCode(); serbook.MDate = dbTime.DBDate; serbook.MTime = dbTime.DBTime; _WarehouseFacade.AddSerialbook(serbook); #endregion } else { #region string MAXNO = (objLot as Serialbook).MAXSerial; string SNNO = (objLot as Serialbook).SNprefix; CartonH.CARINVNO = SNNO + Convert.ToString(MAXNO).PadLeft(3, '0'); CartonH.PICKNO = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtPickNoQuery.Text)); CartonH.STATUS = CartonInvoices_STATUS.Status_Release; CartonH.CDATE = dbTime.DBDate; CartonH.CTIME = dbTime.DBTime; CartonH.CUSER = this.GetUserCode(); CartonH.MDATE = dbTime.DBDate; CartonH.MTIME = dbTime.DBTime; CartonH.MUSER = this.GetUserCode(); _WarehouseFacade.AddCartoninvoices(CartonH); //更新tblserialbook serbook.SNprefix = SNNO; serbook.MAXSerial = Convert.ToString((int.Parse(MAXNO) + 1)); serbook.MUser = this.GetUserCode(); serbook.MDate = dbTime.DBDate; serbook.MTime = dbTime.DBTime; _WarehouseFacade.UpdateSerialbook(serbook); #endregion } } # endregion this.DataProvider.CommitTransaction(); WebInfoPublish.Publish(this, "确认欠料发货数量成功", this.languageComponent1); }
protected void cmdImport_ServerClick(object sender, System.EventArgs e) { this._Facade = new MaterialFacade(this.DataProvider); string errorItemCode = string.Empty; string fileName = FileLoadProcess.UploadFile2ServerUploadFolder(this.Page, this.fileInit, null); if (fileName == null) { WebInfoPublish.Publish(this, "$Error_UploadFileIsEmpty", this.languageComponent1); return; } if (!fileName.ToLower().EndsWith(".csv")) { WebInfoPublish.Publish(this, "$Error_UploadFileTypeError", this.languageComponent1); return; } this.ViewState.Add("UploadedFileName", fileName); if (items == null) { items = GetAllItem(); if (items == null) { return; } } if (items == null || items.Length == 0) { return; } int successNum = 0; int failNum = 0; string objValue = string.Empty; string orgID = GlobalVariables.CurrentOrganizations.First().OrganizationID.ToString(); string mUser = GetUserCode(); for (int i = 0; i < items.Length; i++) { string itemCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(GetFieldValue(items[i], "ITEMCODE"))); string requestQty = FormatHelper.CleanString(GetFieldValue(items[i], "RequestQTY")); if (string.Compare(GetFieldValue(items[i], "EAttribute1"), "OK", true) == 0 || string.Compare(GetFieldValue(items[i], "EAttribute1"), "Insert", true) == 0) { object obj = _Facade.GetMaterialReqStd(itemCode, int.Parse(orgID)); MaterialReqStd newMaterialReqStd = new MaterialReqStd(); if (string.Compare(GetFieldValue(items[i], "EAttribute1"), "Insert", true) == 0) { newMaterialReqStd.ItemCode = itemCode; newMaterialReqStd.OrganizationID = int.Parse(orgID); newMaterialReqStd.RequestQTY = int.Parse(requestQty); newMaterialReqStd.MaintainUser = mUser; _Facade.AddMaterialReqStd(newMaterialReqStd); } else { MaterialReqStd objMaterialReqStd = obj as MaterialReqStd; objValue = requestQty.ToString(); if (objValue != string.Empty) { objMaterialReqStd.RequestQTY = int.Parse(objValue); } objMaterialReqStd.MaintainUser = mUser; if (string.Compare(GetFieldValue(items[i], "EAttribute1"), "OK", true) == 0) { _Facade.UpdateMaterialReqStd(objMaterialReqStd); } } successNum++; } else { failNum++; errorItemCode += GetFieldValue(items[i], "ITEMCODE").ToString() + "\\n";; } } errorItemCode = "\\n导入失败的料号:\\n" + errorItemCode; string strMessage = "导入完成: 成功" + successNum + "笔, 失败" + failNum + "笔\\n" + errorItemCode; string alertInfo = string.Format("<script language=javascript>alert('{0}');</script>", strMessage); if (!this.IsClientScriptBlockRegistered("ImportAlert")) { this.RegisterClientScriptBlock("ImportAlert", alertInfo); } items = null; }
private bool UpLoadFile(string action, Doc doc) { //如果选中文件 if (this.chbFileCheckedEdit.Checked) { //if (this.fileUpLoadEdit.HasFile) //{ try { if (_facade == null) { _facade = new SystemSettingFacade(this.DataProvider); } //object parameter = _facade.GetParameter("DOCDIRPATH", "DOCDIRPATHGROUP"); //if (parameter != null) //{ //服务器目录路径 string filePath = System.AppDomain.CurrentDomain.BaseDirectory + "FileUpload"; //((Domain.BaseSetting.Parameter)parameter).ParameterAlias; if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } if (filePath.LastIndexOf('\\') == filePath.Length - 1) { filePath = filePath.Substring(0, filePath.Length - 1); } int maxDocSerial = -1; if (action == "ADD") { //文档的序号 maxDocSerial = _DocumentFacade.GetDocMaxSerial(); } else { maxDocSerial = doc.Docserial; } Doc objDoc = _DocumentFacade.GetDOC(maxDocSerial) as Doc; if (objDoc != null) { DirectoryInfo dir = new DirectoryInfo(filePath); foreach (FileInfo file in dir.GetFiles()) { if (file.Name == (objDoc as Doc).ServerFileName) { file.Delete(); } } /// '检查文件扩展名字 HttpPostedFile postedFile = fileUpload.PostedFile; string fileName; fileName = System.IO.Path.GetFileName(postedFile.FileName); if (fileName != "") { string serverFullName = fileName.Substring(0, fileName.LastIndexOf(".")) + "_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + fileName.Substring(fileName.LastIndexOf("."));; objDoc.ServerFileName = serverFullName; objDoc.Checkedstatus = "N"; _DocumentFacade.UpdateDOC(objDoc); string currentPath = filePath + "\\" + serverFullName; postedFile.SaveAs(currentPath); } WebInfoPublish.PublishInfo(this, "$Success_UpLoadFile", this.languageComponent1); } return(true); //} //else //{ // WebInfoPublish.PublishInfo(this, "$Error_DocDirPath_NotExist", this.languageComponent1); // return false; //} } catch (Exception ex) { WebInfoPublish.PublishInfo(this, "$Error_UpLoadFile_Exception", this.languageComponent1); return(false); } //} } return(true); }