예제 #1
0
        /// <summary>
        /// 批量更新工时
        /// </summary>
        /// <param name="lstGoods">要更新的物品信息列表</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回操作是否成功的标志</returns>
        public bool UpdateGoods(List <View_S_ScrapGoods> lstGoods, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                foreach (var item in lstGoods)
                {
                    S_ScrapGoods goods = (from r in dataContxt.S_ScrapGoods
                                          where r.ID == item.序号
                                          select r).Single();

                    goods.WorkingHours           = item.工时;
                    goods.Provider               = item.供应商;
                    goods.Reason                 = item.报废原因;
                    goods.ResponsibilityType     = item.责任类型;
                    goods.ResponsibilityProvider = item.责任供应商;
                    goods.ClaimType              = item.索赔类别;
                }

                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// 批量添加物品
        /// </summary>
        /// <param name="dataContxt">LINQ 数据上下文</param>
        /// <param name="lstGoods">要添加的物品信息列表</param>
        public void AddGoods(DepotManagementDataContext dataContxt, List <View_S_ScrapGoods> lstGoods)
        {
            foreach (var item in lstGoods)
            {
                S_ScrapGoods goods = new S_ScrapGoods();

                goods.Bill_ID   = item.报废单号;
                goods.GoodsID   = item.物品ID;
                goods.BatchNo   = item.批次号;
                goods.CVTNumber = item.CVT编号;
                goods.Provider  = item.供应商;
                goods.ResponsibilityProvider = item.责任供应商;
                goods.Quantity    = item.报废数量;
                goods.Reason      = item.报废原因;
                goods.WastrelType = item.报废类别;
                goods.ResponsibilityDepartment = item.责任部门;
                goods.UnitPrice          = item.单价;
                goods.LosingMoney        = item.损失金额;
                goods.WorkingHours       = item.工时;
                goods.Remark             = item.备注;
                goods.ResponsibilityType = item.责任类型;
                goods.Version            = item.版次号;
                goods.ClaimType          = item.索赔类别;

                dataContxt.S_ScrapGoods.InsertOnSubmit(goods);
            }
        }
예제 #3
0
        /// <summary>
        /// 添加物品信息
        /// </summary>
        /// <param name="goods">物品信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回操作是否成功的标志</returns>
        public bool AddGoods(S_ScrapGoods goods, out string error)
        {
            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                error = null;
                dataContxt.S_ScrapGoods.InsertOnSubmit(goods);
                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #4
0
        /// <summary>
        /// 更新物品信息
        /// </summary>
        /// <param name="goods">物品信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回操作是否成功的标志</returns>
        public bool UpdateGoods(S_ScrapGoods goods, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from r in dataContxt.S_ScrapGoods
                             where r.ID == goods.ID
                             select r;

                if (result.Count() > 0)
                {
                    S_ScrapGoods updateGoods = result.Single();

                    updateGoods.Bill_ID   = goods.Bill_ID;
                    updateGoods.BatchNo   = goods.BatchNo;
                    updateGoods.CVTNumber = goods.CVTNumber;
                    updateGoods.GoodsID   = goods.GoodsID;
                    updateGoods.Provider  = goods.Provider;
                    updateGoods.ResponsibilityProvider = goods.ResponsibilityProvider;
                    updateGoods.Reason = goods.Reason;
                    updateGoods.ResponsibilityDepartment = goods.ResponsibilityDepartment;
                    updateGoods.Quantity     = goods.Quantity;
                    updateGoods.UnitPrice    = goods.UnitPrice;
                    updateGoods.LosingMoney  = goods.LosingMoney;
                    updateGoods.WorkingHours = goods.WorkingHours;
                    updateGoods.Remark       = goods.Remark;

                    dataContxt.SubmitChanges();
                }

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 修改报废单退货标志
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="billID">采购退货单号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>修改成功返回True,修改失败返回False</returns>
        private bool SetScrapFlag(DepotManagementDataContext context, string billID, out string error)
        {
            error = null;

            try
            {
                string strSql = "select * from S_MaterialListRejectBill where Bill_ID = '" + billID + "'";

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

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var varData = from a in context.S_ScrapGoods
                                  where a.Bill_ID == dt.Rows[i]["AssociateID"].ToString() &&
                                  a.GoodsID == Convert.ToInt32(dt.Rows[i]["GoodsID"].ToString()) &&
                                  a.BatchNo == dt.Rows[i]["BatchNo"].ToString()
                                  select a;

                    if (varData.Count() != 1)
                    {
                        error = "记录不唯一";
                        return(false);
                    }
                    else
                    {
                        S_ScrapGoods lnqScrapGoods = varData.Single();

                        lnqScrapGoods.IsReject = "1";

                        context.SubmitChanges();
                    }
                }

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
예제 #6
0
        /// <summary>
        /// 赋值账务信息
        /// </summary>
        /// <param name="dataContxt">数据上下文</param>
        /// <param name="bill">单据信息</param>
        /// <param name="item">明细信息</param>
        /// <returns>返回账务信息</returns>
        S_FetchGoodsDetailBill AssignDetailInfo(DepotManagementDataContext dataContxt, S_ScrapBill bill, S_ScrapGoods item)
        {
            Service_Manufacture_WorkShop.IWorkShopStock serverWSStock =
                Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopStock>();
            Service_Manufacture_WorkShop.IWorkShopBasic serverWSBasic =
                Service_Manufacture_WorkShop.ServerModuleFactory.GetServerModule <Service_Manufacture_WorkShop.IWorkShopBasic>();
            WS_WorkShopCode tempWSCode = serverWSBasic.GetPersonnelWorkShop(dataContxt, bill.FillInPersonnelCode);

            S_FetchGoodsDetailBill detailBill = new S_FetchGoodsDetailBill();

            string error = "";

            if (!m_serverProductCode.UpdateProductStock(dataContxt, bill.Bill_ID, "报废", "05", false, item.GoodsID, out error))
            {
                throw new Exception(error);
            }

            detailBill.ID          = Guid.NewGuid();
            detailBill.FetchBIllID = bill.Bill_ID;
            detailBill.BillTime    = ServerTime.Time;
            detailBill.FetchCount  = -(decimal)item.Quantity;
            detailBill.GoodsID     = item.GoodsID;
            detailBill.BatchNo     = item.BatchNo == "无批次" ? "" : item.BatchNo;

            WS_WorkShopStock tempWSStock = new WS_WorkShopStock();

            if (tempWSCode != null)
            {
                tempWSStock = serverWSStock.GetStockSingleInfo(dataContxt, tempWSCode.WSCode, item.GoodsID, item.BatchNo);
            }

            detailBill.UnitPrice        = tempWSStock == null ? 0 : tempWSStock.UnitPrice;
            detailBill.Price            = detailBill.UnitPrice * (decimal)detailBill.FetchCount;
            detailBill.Provider         = item.Provider;
            detailBill.FillInPersonnel  = bill.FillInPersonnel;
            detailBill.FinanceSignatory = null;
            detailBill.DepartDirector   = bill.DepartmentDirector;
            detailBill.DepotManager     = bill.DepotManager;
            detailBill.OperationType    = (int)CE_SubsidiaryOperationType.报废;
            detailBill.Remark           = "【报废】";
            detailBill.FillInDate       = bill.Bill_Time;

            return(detailBill);
        }
예제 #7
0
        /// <summary>
        /// 插入报废单
        /// </summary>
        /// <param name="ctx">LINQ数据上下文</param>
        /// <param name="outSourcing">Linq操作数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>插入成功返回True,插入失败返回False</returns>
        public bool AddScrapBill(DepotManagementDataContext ctx,
                                 S_CheckOutInDepotForOutsourcingBill outSourcing, out string error)
        {
            error = null;
            string strBillID = "";

            try
            {
                ScrapBillServer serverScrapBill = new ScrapBillServer();

                S_ScrapBill lnqBill = new S_ScrapBill();

                strBillID = m_assignBill.AssignNewNo(serverScrapBill, CE_BillTypeEnum.报废单.ToString());

                lnqBill.AuthorizeTime     = ServerTime.Time;
                lnqBill.Bill_ID           = strBillID;
                lnqBill.Bill_Time         = ServerTime.Time;
                lnqBill.BillStatus        = "已完成";
                lnqBill.Checker           = outSourcing.Checker;
                lnqBill.DeclareDepartment = m_serverDepartment.GetDeptInfoFromPersonnelInfo(
                    outSourcing.DeclarePersonnel).Rows[0]["DepartmentCode"].ToString();
                lnqBill.DepartmentDirector  = "";
                lnqBill.DepotManager        = outSourcing.ManagerPersonnel;
                lnqBill.DepotTime           = ServerTime.Time;
                lnqBill.FillInPersonnel     = outSourcing.DeclarePersonnel;
                lnqBill.FillInPersonnelCode = UniversalFunction.GetPersonnelCode(outSourcing.DeclarePersonnel);
                lnqBill.NotifyChecker       = UniversalFunction.GetPersonnelCode(outSourcing.Checker);
                lnqBill.ProductType         = "";
                lnqBill.Remark   = "关联委外报检入库单【" + outSourcing.Bill_ID + "】,自动生成";
                lnqBill.Sanction = outSourcing.Checker;

                ctx.S_ScrapBill.InsertOnSubmit(lnqBill);

                S_ScrapGoods lnqGoods = new S_ScrapGoods();

                lnqGoods.BatchNo  = outSourcing.BatchNo;
                lnqGoods.Bill_ID  = strBillID;
                lnqGoods.GoodsID  = outSourcing.GoodsID;
                lnqGoods.Provider = outSourcing.Provider;
                lnqGoods.Quantity = outSourcing.DeclareWastrelCount;
                lnqGoods.Reason   = "检测报废,关联委外报检入库单【" + outSourcing.Bill_ID + "】,自动生成";
                lnqGoods.Remark   = "检测报废,关联委外报检入库单【" + outSourcing.Bill_ID + "】,自动生成";
                lnqGoods.ResponsibilityDepartment = "GYS";
                lnqGoods.ResponsibilityProvider   = outSourcing.Provider;
                lnqGoods.ResponsibilityType       = "返 修 废";
                lnqGoods.UnitPrice    = 0;
                lnqGoods.WastrelType  = 9;
                lnqGoods.WorkingHours = 0;

                ctx.S_ScrapGoods.InsertOnSubmit(lnqGoods);

                m_assignBill.UseBillNo(CE_BillTypeEnum.报废单.ToString(), strBillID);

                return(true);
            }
            catch (Exception ex)
            {
                m_assignBill.CancelBillNo(CE_BillTypeEnum.报废单.ToString(), strBillID);
                error = ex.Message;
                return(false);
            }
        }