Exemplo n.º 1
0
        /// <summary>
        /// 保存业务信息
        /// </summary>
        /// <param name="billInfo">业务总单信息</param>
        /// <param name="detailInfo">业务明细信息</param>
        public void SaveInfo(Business_WarehouseInPut_AOG billInfo, List <View_Business_WarehouseInPut_AOGDetail> detailInfo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            ctx.Connection.Open();
            ctx.Transaction = ctx.Connection.BeginTransaction();

            try
            {
                var varData = from a in ctx.Business_WarehouseInPut_AOG
                              where a.BillNo == billInfo.BillNo
                              select a;

                if (varData.Count() == 1)
                {
                    Business_WarehouseInPut_AOG lnqBill = varData.Single();

                    lnqBill.Remark = billInfo.Remark;
                }
                else if (varData.Count() == 0)
                {
                    ctx.Business_WarehouseInPut_AOG.InsertOnSubmit(billInfo);
                }
                else
                {
                    throw new Exception("单据数据不唯一");
                }

                var varDetail = from a in ctx.Business_WarehouseInPut_AOGDetail
                                where a.BillNo == billInfo.BillNo
                                select a;

                ctx.Business_WarehouseInPut_AOGDetail.DeleteAllOnSubmit(varDetail);
                ctx.SubmitChanges();

                foreach (View_Business_WarehouseInPut_AOGDetail item in detailInfo)
                {
                    Business_WarehouseInPut_AOGDetail lnqDetail = new Business_WarehouseInPut_AOGDetail();

                    lnqDetail.BillRelate = item.关联业务;
                    lnqDetail.BatchNo    = item.批次号;
                    lnqDetail.BillNo     = billInfo.BillNo;
                    lnqDetail.GoodsCount = item.数量;
                    lnqDetail.GoodsID    = item.物品ID;
                    lnqDetail.Provider   = item.供应商;
                    lnqDetail.Remark     = item.备注;

                    ctx.Business_WarehouseInPut_AOGDetail.InsertOnSubmit(lnqDetail);
                }

                ctx.SubmitChanges();
                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 2
0
 public override void LoadFormInfo()
 {
     try
     {
         m_billNoControl = new BillNumberControl(CE_BillTypeEnum.到货单.ToString(), m_serviceAOG);
         m_lnqBillInfo   = m_serviceAOG.GetSingleBillInfo(this.FlowInfo_BillNo);
         SetInfo();
     }
     catch (Exception ex)
     {
         MessageDialog.ShowErrorMessage(ex.Message);
     }
 }
Exemplo n.º 3
0
        private bool customForm_PanelGetDateInfo(CE_FlowOperationType flowOperationType)
        {
            try
            {
                if (!CheckData())
                {
                    return(false);
                }

                m_lnqBillInfo = new Business_WarehouseInPut_AOG();

                m_lnqBillInfo.BillNo = txtBillNo.Text;
                m_lnqBillInfo.Remark = txtRemark.Text;

                List <View_Business_WarehouseInPut_AOGDetail> listTemp = new List <View_Business_WarehouseInPut_AOGDetail>();

                foreach (DataGridViewRow dgvr in customDataGridView1.Rows)
                {
                    View_Business_WarehouseInPut_AOGDetail detailTemp = new View_Business_WarehouseInPut_AOGDetail();

                    detailTemp.关联业务 = dgvr.Cells["关联业务"].Value == null ? "" : dgvr.Cells["关联业务"].Value.ToString();
                    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.数量   = 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();

                    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);
            }
        }
Exemplo n.º 4
0
        private bool 到货单_Form_CommonProcessSubmit(CustomFlowForm form, string advise)
        {
            IAOGService serviceAOG = Service_Manufacture_Storage.ServerModuleFactory.GetServerModule <IAOGService>();

            try
            {
                List <View_Business_WarehouseInPut_AOGDetail> detailInfo =
                    form.ResultInfo as List <View_Business_WarehouseInPut_AOGDetail>;
                Business_WarehouseInPut_AOG lnqAOG = form.ResultList[0] as Business_WarehouseInPut_AOG;

                this.OperationType = GeneralFunction.StringConvertToEnum <CE_FlowOperationType>(form.ResultList[1].ToString());
                this.BillNo        = lnqAOG.BillNo;

                switch (this.OperationType)
                {
                case CE_FlowOperationType.提交:
                    serviceAOG.SaveInfo(lnqAOG, detailInfo);
                    break;

                case CE_FlowOperationType.暂存:
                    serviceAOG.SaveInfo(lnqAOG, detailInfo);
                    break;

                case CE_FlowOperationType.回退:
                    break;

                case CE_FlowOperationType.未知:
                    break;

                default:
                    break;
                }

                if (!serviceAOG.IsExist(lnqAOG.BillNo))
                {
                    MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面");
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }
Exemplo n.º 5
0
        void SetInfo()
        {
            if (m_lnqBillInfo != null)
            {
                lbBillStatus.Text = m_serverFlow.GetNowBillStatus(m_lnqBillInfo.BillNo);

                txtBillNo.Text = m_lnqBillInfo.BillNo;
                txtRemark.Text = m_lnqBillInfo.Remark;
            }
            else
            {
                lbBillStatus.Text = CE_CommonBillStatus.新建单据.ToString();

                m_lnqBillInfo = new Business_WarehouseInPut_AOG();

                txtBillNo.Text       = this.FlowInfo_BillNo;
                m_lnqBillInfo.BillNo = txtBillNo.Text;
            }

            m_listViewDetail = m_serviceAOG.GetListViewDetailInfo(m_lnqBillInfo.BillNo);
            RefreshDataGridView(m_listViewDetail);
        }