private bool 出库申请单_Form_CommonProcessSubmit(CustomFlowForm form, string advise) { IRequisitionService_OutPut serviceRequistion = Service_Manufacture_Storage.ServerModuleFactory.GetServerModule <IRequisitionService_OutPut>(); try { List <View_Business_WarehouseOutPut_RequisitionDetail> detailInfo = form.ResultInfo as List <View_Business_WarehouseOutPut_RequisitionDetail>; Business_WarehouseOutPut_Requisition lnqRequisition = form.ResultList[0] as Business_WarehouseOutPut_Requisition; this.OperationType = GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[1].ToString()); this.BillNo = lnqRequisition.BillNo; switch (this.OperationType) { case CE_FlowOperationType.提交: serviceRequistion.SaveInfo(lnqRequisition, detailInfo); break; case CE_FlowOperationType.暂存: serviceRequistion.SaveInfo(lnqRequisition, detailInfo); break; case CE_FlowOperationType.回退: break; case CE_FlowOperationType.未知: break; default: break; } if (!serviceRequistion.IsExist(lnqRequisition.BillNo)) { MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面"); return(false); } return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
public override void LoadFormInfo() { try { m_billNoControl = new BillNumberControl(CE_BillTypeEnum.出库申请单.ToString(), m_serviceRequistion); m_lnqBillInfo = m_serviceRequistion.GetSingleBillInfo(this.FlowInfo_BillNo); this.关联业务.m_OnCompleteSearch += new GlobalObject.DelegateCollection.NonArgumentHandle(关联业务_m_OnCompleteSearch); this.图号型号.m_OnCompleteSearch += new GlobalObject.DelegateCollection.NonArgumentHandle(图号型号_m_OnCompleteSearch); this.批次号.m_OnCompleteSearch += new GlobalObject.DelegateCollection.NonArgumentHandle(批次号_m_OnCompleteSearch); SetInfo(); } catch (Exception ex) { MessageDialog.ShowErrorMessage(ex.Message); } }
void SetInfo() { List <string> listType = GlobalObject.GeneralFunction.GetEumnList(typeof(CE_OutPutBusinessType)); cmbBillType.DataSource = listType; cmbBillType.SelectedIndex = -1; if (m_lnqBillInfo != null) { lbBillStatus.Text = m_serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo); txtBillNo.Text = m_lnqBillInfo.BillNo; txtRemark.Text = m_lnqBillInfo.Remark; txtApplyingDepartment.Tag = m_lnqBillInfo.ApplyingDepartment; txtApplyingDepartment.Text = UniversalFunction.GetDeptName(m_lnqBillInfo.ApplyingDepartment); txtTypeDetail.Text = m_lnqBillInfo.BillTypeDetail; cmbBillType.Text = m_lnqBillInfo.BillType; } else { lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString(); m_lnqBillInfo = new Business_WarehouseOutPut_Requisition(); txtBillNo.Text = this.FlowInfo_BillNo; m_lnqBillInfo.BillNo = txtBillNo.Text; txtApplyingDepartment.Tag = BasicInfo.DeptCode; txtApplyingDepartment.Text = BasicInfo.DeptName; } m_listViewDetail = m_serviceRequistion.GetListViewDetailInfo(m_lnqBillInfo.BillNo); RefreshDataGridView(m_listViewDetail); }
private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType) { try { if (!CheckData()) { return(false); } m_lnqBillInfo = new Business_WarehouseOutPut_Requisition(); m_lnqBillInfo.BillNo = txtBillNo.Text; m_lnqBillInfo.BillType = cmbBillType.Text; m_lnqBillInfo.BillTypeDetail = txtTypeDetail.Text; m_lnqBillInfo.ApplyingDepartment = txtApplyingDepartment.Tag.ToString(); m_lnqBillInfo.Remark = txtRemark.Text; List <View_Business_WarehouseOutPut_RequisitionDetail> listTemp = new List <View_Business_WarehouseOutPut_RequisitionDetail>(); foreach (DataGridViewRow dgvr in customDataGridView1.Rows) { View_Business_WarehouseOutPut_RequisitionDetail detailTemp = new View_Business_WarehouseOutPut_RequisitionDetail(); detailTemp.备注 = dgvr.Cells["备注"].Value == null ? "" : dgvr.Cells["备注"].Value.ToString(); detailTemp.单据号 = txtBillNo.Text; detailTemp.单位 = dgvr.Cells["单位"].Value == null ? "" : dgvr.Cells["单位"].Value.ToString(); detailTemp.供应商 = dgvr.Cells["供应商"].Value == null ? "" : dgvr.Cells["供应商"].Value.ToString(); detailTemp.关联业务 = dgvr.Cells["关联业务"].Value == null ? "" : dgvr.Cells["关联业务"].Value.ToString(); detailTemp.规格 = dgvr.Cells["规格"].Value == null ? "" : dgvr.Cells["规格"].Value.ToString(); detailTemp.批次号 = dgvr.Cells["批次号"].Value == null ? "" : dgvr.Cells["批次号"].Value.ToString(); detailTemp.数量 = Convert.ToDecimal(dgvr.Cells["数量"].Value); detailTemp.图号型号 = dgvr.Cells["图号型号"].Value == null ? "" : dgvr.Cells["图号型号"].Value.ToString(); detailTemp.物品ID = Convert.ToInt32(dgvr.Cells["物品ID"].Value); detailTemp.物品名称 = dgvr.Cells["物品名称"].Value == null ? "" : dgvr.Cells["物品名称"].Value.ToString(); switch (GlobalObject.GeneralFunction.StringConvertToEnum <CE_OutPutBusinessType>(m_lnqBillInfo.BillType)) { case CE_OutPutBusinessType.领料: case CE_OutPutBusinessType.营销出库: case CE_OutPutBusinessType.营销退货: IProductCodeServer serverProductCode = ServerModule.ServerModuleFactory.GetServerModule <IProductCodeServer>(); if (!serverProductCode.IsFitCount(detailTemp.物品ID, Convert.ToInt32(detailTemp.数量), detailTemp.单据号)) { MessageBox.Show("请对产品设置流水号,并保证产品数量与流水号数一致", "提示"); return(false); } break; case CE_OutPutBusinessType.采购退货: break; case CE_OutPutBusinessType.自制件退货: break; default: break; } listTemp.Add(detailTemp); } this.FlowInfo_BillNo = txtBillNo.Text; this.ResultInfo = listTemp; this.ResultList = new List <object>(); this.ResultList.Add(m_lnqBillInfo); this.ResultList.Add(flowOperationType); return(true); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); return(false); } }
/// <summary> /// 保存业务信息 /// </summary> /// <param name="billInfo">业务总单信息</param> /// <param name="detailInfo">业务明细信息</param> public void SaveInfo(Business_WarehouseOutPut_Requisition billInfo, List <View_Business_WarehouseOutPut_RequisitionDetail> detailInfo) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { var varData = from a in ctx.Business_WarehouseOutPut_Requisition where a.BillNo == billInfo.BillNo select a; if (varData.Count() == 1) { Business_WarehouseOutPut_Requisition lnqBill = varData.Single(); lnqBill.ApplyingDepartment = billInfo.ApplyingDepartment; lnqBill.BillType = billInfo.BillType; lnqBill.BillTypeDetail = billInfo.BillTypeDetail; lnqBill.Remark = billInfo.Remark; } else if (varData.Count() == 0) { ctx.Business_WarehouseOutPut_Requisition.InsertOnSubmit(billInfo); } else { throw new Exception("单据数据不唯一"); } var varDetail = from a in ctx.Business_WarehouseOutPut_RequisitionDetail where a.BillNo == billInfo.BillNo select a; ctx.Business_WarehouseOutPut_RequisitionDetail.DeleteAllOnSubmit(varDetail); ctx.SubmitChanges(); foreach (View_Business_WarehouseOutPut_RequisitionDetail item in detailInfo) { Business_WarehouseOutPut_RequisitionDetail lnqDetail = new Business_WarehouseOutPut_RequisitionDetail(); lnqDetail.BatchNo = item.批次号; lnqDetail.BillNo = billInfo.BillNo; lnqDetail.BillRelate = item.关联业务; lnqDetail.GoodsCount = item.数量; lnqDetail.GoodsID = item.物品ID; lnqDetail.Provider = item.供应商; lnqDetail.Remark = item.备注; ctx.Business_WarehouseOutPut_RequisitionDetail.InsertOnSubmit(lnqDetail); } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }