private void txtBatchNo_OnCompleteSearch()
        {
            txtBatchNo.Text = txtBatchNo.DataResult["批次号"].ToString();

            WS_WorkShopStock tempStock = m_serverStock.GetStockSingleInfo(cmbWSCode.SelectedValue.ToString(),
                                                                          Convert.ToInt32(txtCode.Tag),
                                                                          txtBatchNo.DataResult["批次号"].ToString());

            lbStockCount.Text = tempStock == null ? "0" : tempStock.StockCount.ToString();
        }
Exemplo n.º 2
0
        void GetGoodsInfo()
        {
            if (txtCode.Tag == null)
            {
                lbHYDW.Text = "";
                lbKCDW.Text = "";
                return;
            }

            View_F_GoodsPlanCost tempLnq = UniversalFunction.GetGoodsInfo(Convert.ToInt32(txtCode.Tag));

            if (tempLnq == null)
            {
                lbHYDW.Text = "";
                lbKCDW.Text = "";
                return;
            }

            lbHYDW.Text = tempLnq.单位;
            lbKCDW.Text = tempLnq.单位;

            WS_WorkShopStock tempStock =
                m_serverStock.GetStockSingleInfo(CE_WorkShopCode.ZPCJ.ToString(), Convert.ToInt32(txtCode.Tag), txtBatchNo.Text);

            if (tempStock == null)
            {
                lbStockCount.Text = "0";
            }
            else
            {
                lbStockCount.Text = tempStock.StockCount.ToString();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 确认单据
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="list">明细信息</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool AffirmBill(string billNo, DataTable list, out string error)
        {
            error = null;

            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

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

            try
            {
                var varData = from a in ctx.WS_ConsumptionBill
                              where a.BillNo == billNo
                              select a;

                WS_ConsumptionBill tempBill = new WS_ConsumptionBill();

                if (varData.Count() == 1)
                {
                    tempBill = varData.Single();

                    if (tempBill.BillStatus != ConsumptionBillStatus.等待确认.ToString())
                    {
                        throw new Exception("单据状态错误,请重新确认");
                    }

                    tempBill.BillStatus = ConsumptionBillStatus.单据已完成.ToString();
                    tempBill.Affirm     = BasicInfo.LoginName;
                    tempBill.AffirmDate = ServerTime.Time;
                }
                else
                {
                    throw new Exception("数据不唯一,请重新确认");
                }


                ListControl(ctx, tempBill, list);
                ctx.SubmitChanges();

                foreach (DataRow dr in list.Rows)
                {
                    WS_Subsidiary tempSubsidiary = new WS_Subsidiary();

                    tempSubsidiary.BatchNo        = dr["批次号"].ToString();
                    tempSubsidiary.BillNo         = tempBill.BillNo;
                    tempSubsidiary.GoodsID        = Convert.ToInt32(dr["物品ID"]);
                    tempSubsidiary.OperationCount = Convert.ToDecimal(dr["数量"]);
                    tempSubsidiary.OperationType  = (int)CE_SubsidiaryOperationType.车间耗用;
                    tempSubsidiary.Remark         = dr["备注"].ToString();
                    tempSubsidiary.WSCode         = tempBill.WSCode;
                    tempSubsidiary.Proposer       = tempBill.Proposer;
                    tempSubsidiary.ProposerDate   = (DateTime)tempBill.ProposerDate;
                    tempSubsidiary.Affirm         = BasicInfo.LoginName;
                    tempSubsidiary.AffirmDate     = ServerTime.Time;

                    IWorkShopStock   serverStock = ServerModuleFactory.GetServerModule <IWorkShopStock>();
                    WS_WorkShopStock tempWSStock = serverStock.GetStockSingleInfo(tempSubsidiary.WSCode,
                                                                                  tempSubsidiary.GoodsID,
                                                                                  tempSubsidiary.BatchNo);

                    tempSubsidiary.UnitPrice = tempWSStock == null ? 0 : tempWSStock.UnitPrice;
                    tempSubsidiary.BillTime  = ServerTime.Time;

                    View_HR_Personnel tempHR = UniversalFunction.GetPersonnelInfo(tempSubsidiary.Proposer);

                    if (tempHR == null)
                    {
                        throw new Exception("申请人员不存在");
                    }

                    tempSubsidiary.Applicant = tempHR.部门名称;

                    serverStock.OperationSubsidiary(ctx, tempSubsidiary);
                }

                ctx.SubmitChanges();
                ctx.Transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                error = ex.Message;
                return(false);
            }
        }