/// <summary>
        /// 删除返回件
        /// </summary>
        /// <param name="strDJH">单据号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool DeleteReplace(string strDJH, out string error)
        {
            error = "";

            try
            {
                WebSeverDataContext dataContxt = WebDatabaseParameter.WebDataContext;

                var vardata = from a in dataContxt.S_ReplaceAccessory
                              where a.ServiceID == strDJH
                              select a;

                if (vardata.Count() != 0)
                {
                    dataContxt.S_ReplaceAccessory.DeleteAllOnSubmit(vardata);
                }

                dataContxt.SubmitChanges();
            }
            catch (Exception ex)
            {
                error = ex.Message;

                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 通过单据号删除函电信息
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool DeleteByBillNo(string billNo, out string error)
        {
            error = "";

            try
            {
                WebSeverDataContext dataContxt = WebDatabaseParameter.WebDataContext;

                var varData = from a in dataContxt.S_AfterService
                              where a.ServiceID == billNo
                              select a;

                if (varData.Count() != 1)
                {
                    throw new Exception("单据信息有误!");
                }
                else
                {
                    dataContxt.S_AfterService.DeleteAllOnSubmit(varData);

                    var varBug = from a in dataContxt.OF_BugMessageInfo
                                 where a.ServiceID == billNo
                                 select a;

                    dataContxt.OF_BugMessageInfo.DeleteAllOnSubmit(varBug);
                    dataContxt.SubmitChanges();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// 添加返回件
        /// </summary>
        /// <param name="dtAddTb">数据集</param>
        /// <param name="strDJH">单据号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool InsertReplace(DataTable dtAddTb, string strDJH, out string error)
        {
            error = "";

            WebSeverDataContext dataContxt = WebDatabaseParameter.WebDataContext;

            try
            {
                if (DeleteReplace(strDJH, out error))
                {
                    for (int i = 0; i < dtAddTb.Rows.Count; i++)
                    {
                        S_ReplaceAccessory list = new S_ReplaceAccessory();

                        list.ServiceID    = strDJH;
                        list.OldGoodsCode = dtAddTb.Rows[i]["OldGoodsCode"].ToString();
                        list.OldGoodsName = dtAddTb.Rows[i]["OldGoodsName"].ToString();
                        list.OldSpec      = dtAddTb.Rows[i]["OldSpec"].ToString();
                        list.OldCvtID     = dtAddTb.Rows[i]["OldCvtID"].ToString();
                        list.Count        = Convert.ToInt32(dtAddTb.Rows[i]["Count"].ToString());
                        list.Unit         = dtAddTb.Rows[i]["Unit"].ToString();
                        list.NewGoodsCode = dtAddTb.Rows[i]["NewGoodsCode"].ToString();
                        list.NewGoodsName = dtAddTb.Rows[i]["NewGoodsName"].ToString();
                        list.NewSpec      = dtAddTb.Rows[i]["NewSpec"].ToString();
                        list.NewCvtID     = dtAddTb.Rows[i]["NewCvtID"].ToString();
                        list.NewGoodsID   = dtAddTb.Rows[i]["NewGoodsID"].ToString();
                        list.OldGoodsID   = dtAddTb.Rows[i]["OldGoodsID"].ToString();

                        if (dtAddTb.Rows[i]["BackTime"].ToString() != "")
                        {
                            list.BackTime = Convert.ToDateTime(dtAddTb.Rows[i]["BackTime"].ToString());
                        }

                        if (dtAddTb.Rows[i]["GiveOutDate"].ToString() != "")
                        {
                            list.GiveOutDate = Convert.ToDateTime(dtAddTb.Rows[i]["GiveOutDate"].ToString());
                        }

                        dataContxt.S_ReplaceAccessory.InsertOnSubmit(list);
                    }

                    dataContxt.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;

                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 责任人确认,修改表信息
        /// </summary>
        /// <param name="back">数据集对象</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool UpdateDutyPerson(S_ServiceFeedBack back, out string error)
        {
            error = "";

            try
            {
                WebSeverDataContext dataContxt = WebDatabaseParameter.WebDataContext;

                var varData = from a in dataContxt.S_ServiceFeedBack
                              where a.FK_Bill_ID == back.FK_Bill_ID
                              select a;

                if (varData.Count() != 1)
                {
                    error = "数据有错误!";

                    return(false);
                }
                else
                {
                    S_ServiceFeedBack list = varData.Single();

                    list.Temporary = back.Temporary;
                    list.Analyse   = back.Analyse;
                    //list.foreverImplement = back.foreverImplement;
                    list.IsFMEAfile     = back.IsFMEAfile;
                    list.IsOpen         = back.IsOpen;
                    list.Status         = "等待质管检查";
                    list.DutyPersonDate = DateTime.Now;

                    dataContxt.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;

                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 责任部门确认,修改表
        /// </summary>
        /// <param name="billID">单据号</param>
        /// <param name="dutyPerson">责任人</param>
        /// <param name="finish">完成要求</param>
        /// <param name="stock">库存产品意见</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool UpdateDutyDept(string billID, string dutyPerson, string finish,
                                   string stock, out string error)
        {
            error = "";

            try
            {
                WebSeverDataContext dataContxt = WebDatabaseParameter.WebDataContext;

                var varData = from a in dataContxt.S_ServiceFeedBack
                              where a.FK_Bill_ID == billID
                              select a;

                if (varData.Count() != 1)
                {
                    error = "数据有错误!";

                    return(false);
                }
                else
                {
                    S_ServiceFeedBack list = varData.Single();

                    list.DutyDeptCharge     = BasicInfo.LoginID;
                    list.DutyPerson         = dutyPerson;
                    list.FinishClaim        = finish;
                    list.StockSuggestion    = stock;
                    list.DutyDeptChargeDate = ServerTime.Time;
                    list.Status             = "等待责任人确认";

                    dataContxt.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;

                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 插入WEB 数据库
        /// </summary>
        /// <param name="bill">单据信息</param>
        /// <param name="error">出错时返回错误信息</param>
        /// <returns>操作是否成功的标志</returns>
        public bool InsertWebData(S_CheckOutInDepotBill bill, out string error)
        {
            try
            {
                error = null;

                int intListID = GetWebListID(bill.Bill_ID);

                if (intListID == 0)
                {
                    error = "数据库无记录";
                    return(false);
                }

                WebSeverDataContext dataContext = WebServerModule.WebDatabaseParameter.WebDataContext;

                OF_OrderForm_ArrivalInfo lnqArrival = new OF_OrderForm_ArrivalInfo();

                lnqArrival.ActualDate          = bill.ArriveGoods_Time;
                lnqArrival.ActuaQuantity       = Convert.ToDecimal(bill.DepotManagerAffirmCount);
                lnqArrival.ConcessionQuantity  = Convert.ToDecimal(bill.ConcessionCount);
                lnqArrival.DestructQuantity    = Convert.ToDecimal(bill.DeclareWastrelCount);
                lnqArrival.EligibilityQuantity = Convert.ToDecimal(bill.EligibleCount);
                lnqArrival.ListID         = intListID;
                lnqArrival.QualityInfo    = bill.QualityInfo;
                lnqArrival.RejectQuantity = Convert.ToDecimal(bill.ReimbursementCount);
                lnqArrival.BatchNo        = bill.BatchNo;
                lnqArrival.InBillID       = bill.Bill_ID;

                dataContext.OF_OrderForm_ArrivalInfo.InsertOnSubmit(lnqArrival);

                dataContext.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 质管部检验,修改表信息
        /// </summary>
        /// <param name="billID">单据号</param>
        /// <param name="cloes">是否关闭</param>
        /// <param name="practice">落实情况</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool UpdateZGCheck(string billID, string cloes, string practice, out string error)
        {
            error = "";

            try
            {
                WebSeverDataContext dataContxt = WebDatabaseParameter.WebDataContext;

                var varData = from a in dataContxt.S_ServiceFeedBack
                              where a.FK_Bill_ID == billID
                              select a;

                if (varData.Count() != 1)
                {
                    error = "数据有错误!";

                    return(false);
                }
                else
                {
                    S_ServiceFeedBack list = varData.Single();

                    list.ZGCheckName = BasicInfo.LoginID;
                    list.IsClose     = cloes;
                    list.Practicable = practice;
                    list.Status      = "单据完成";
                    list.ZGCheckDate = DateTime.Now;

                    dataContxt.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;

                return(false);
            }

            return(true);
        }
Esempio n. 8
0
        /// <summary>
        /// 插入WEB订单
        /// </summary>
        /// <param name="yearAndMonth">操作年月字符串</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>插入成功返回True,插入失败返回False</returns>
        bool InsertWebOrderForm(string yearAndMonth, out string error)
        {
            error = null;
            BargainInfoServer serverBargainInfo = new BargainInfoServer();

            try
            {
                WebSeverDataContext dataContext = WebServerModule.WebDatabaseParameter.WebDataContext;
                //插入订单Bill
                string strSql = "select distinct 订单号 + '-' + convert(varchar(50),ID) as 订单号 ," +
                                " 合同号 from (select 物品ID,供应商,订单号,到货数,到货日期,合同号, " +
                                " Row_Number()Over(partition by 物品ID,供应商 order by 到货日期) as ID " +
                                " from View_B_WebForOrderFormList as a inner join View_B_WebForAffrimTime as b " +
                                " on a.序号 = b.明细ID where 单据号 = '" + yearAndMonth + "') as a";

                DataTable dtBill = GlobalObject.DatabaseServer.QueryInfo(strSql);

                for (int i = 0; i < dtBill.Rows.Count; i++)
                {
                    DataRow drBargainInfo = serverBargainInfo.GetBargainInfoDataRow(dtBill.Rows[i]["合同号"].ToString());

                    OF_OrderFormInfo lnqInfo = new OF_OrderFormInfo();

                    lnqInfo.OrderFormNumber  = dtBill.Rows[i]["订单号"].ToString();
                    lnqInfo.Provider         = drBargainInfo["Provider"].ToString();
                    lnqInfo.Buyer            = drBargainInfo["Buyer"].ToString();
                    lnqInfo.ProviderLinkMan  = drBargainInfo["ProviderLinkman"].ToString();
                    lnqInfo.ProviderLinkMode = drBargainInfo["LaisonMode"].ToString();
                    lnqInfo.Remark           = drBargainInfo["Remark"].ToString();
                    lnqInfo.CreateDate       = ServerTime.Time;

                    dataContext.OF_OrderFormInfo.InsertOnSubmit(lnqInfo);
                }

                //插入订单List
                strSql = "select 图号型号,物品名称,规格,到货数," +
                         " 订单号 + '-' + convert(varchar(50),ID) as 订单号 ," +
                         " convert(varchar(10), 到货日期,120) + ' 23:59:59' as 到货日期 " +
                         " from (select 图号型号,物品名称,规格,订单号,到货数,到货日期, " +
                         " Row_Number()Over(partition by 物品ID,供应商 order by 到货日期) as ID " +
                         " from View_B_WebForOrderFormList as a " +
                         " inner join View_B_WebForAffrimTime as b " +
                         " on a.序号 = b.明细ID where 单据号 = '" + yearAndMonth + "') as a ";

                DataTable dtList = GlobalObject.DatabaseServer.QueryInfo(strSql);

                for (int i = 0; i < dtList.Rows.Count; i++)
                {
                    OF_OrderFormGoods lnqGoods = new OF_OrderFormGoods();

                    lnqGoods.OrderFormNumber = dtList.Rows[i]["订单号"].ToString();
                    lnqGoods.GoodsCode       = dtList.Rows[i]["图号型号"].ToString();
                    lnqGoods.GoodsName       = dtList.Rows[i]["物品名称"].ToString();
                    lnqGoods.Spec            = dtList.Rows[i]["规格"].ToString();
                    lnqGoods.ArriveTime      = Convert.ToDateTime(dtList.Rows[i]["到货日期"]);
                    lnqGoods.OrderCount      = Convert.ToDecimal(dtList.Rows[i]["到货数"]);

                    dataContext.OF_OrderFormGoods.InsertOnSubmit(lnqGoods);
                }

                dataContext.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 质管部确认,修改表信息
        /// </summary>
        /// <param name="billID">单据号</param>
        /// <param name="ChargeSuggestion">质管部意见</param>
        /// <param name="dutyDept">责任部门</param>
        /// <param name="replyTime">要求回复时间</param>
        /// <param name="appCount">出现次数</param>
        /// <param name="associatedBillNo">问题相似的关联单据</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool UpdateZGAffirm(string billID, string ChargeSuggestion, string dutyDept,
                                   DateTime replyTime, int appCount, string associatedBillNo, out string error)
        {
            error = "";

            try
            {
                WebSeverDataContext dataContxt = WebDatabaseParameter.WebDataContext;

                var varData = from a in dataContxt.S_ServiceFeedBack
                              where a.FK_Bill_ID == billID
                              select a;

                if (varData.Count() != 1)
                {
                    error = "数据有错误!";

                    return(false);
                }
                else
                {
                    S_ServiceFeedBack list = varData.Single();

                    list.ZGChargeSuggestion = ChargeSuggestion;
                    list.DutyDept           = dutyDept;
                    list.ReplyTime          = replyTime;
                    list.AppearCount        = appCount;
                    list.SignatureDate      = ServerTime.Time;
                    list.Signature          = BasicInfo.LoginID;

                    if (associatedBillNo == null)
                    {
                        list.Status = "等待责任部门确认";
                    }
                    else
                    {
                        list.Status = "单据完成";

                        var resultList = from c in dataContxt.S_ServiceFeedBack
                                         where c.FK_Bill_ID == associatedBillNo
                                         select c;

                        if (resultList.Count() == 1)
                        {
                            S_ServiceFeedBack feedback = resultList.Single();

                            list.Analyse = feedback.Analyse;
                            //list.foreverImplement = feedback.foreverImplement;
                            list.FinishClaim     = feedback.FinishClaim;
                            list.IsFMEAfile      = feedback.IsFMEAfile;
                            list.IsOpen          = feedback.IsOpen;
                            list.Temporary       = feedback.Temporary;
                            list.StockSuggestion = feedback.StockSuggestion;
                            list.SameBillNo      = associatedBillNo;
                            list.DutyPerson      = feedback.DutyPerson;
                            list.DutyDept        = feedback.DutyDept;
                            list.Practicable     = feedback.Practicable;
                            list.IsClose         = "是";
                        }
                    }

                    dataContxt.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;

                return(false);
            }

            return(true);
        }