Exemplo n.º 1
0
        /// <summary>
        /// 操作
        /// </summary>
        /// <param name="listInfo">清单明细</param>
        /// <param name="billNo">单号</param>
        /// <param name="edition">总成型号</param>
        /// <param name="applicable">适用范围</param>
        public void OperationInfo(List <View_S_DebitSchedule> listInfo, string billNo, string edition, CE_DebitScheduleApplicable applicable)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

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

            try
            {
                IFlowServer serverFlow = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>();

                if (serverFlow.GetNextBillStatus(billNo) == ProductOrderListStatus.单据完成.ToString())
                {
                    var varOrder = from a in ctx.BASE_ProductOrder
                                   where a.Edition == edition && a.Applicable == applicable.ToString()
                                   select a;

                    JudgeAssembly(ctx, listInfo, edition, applicable);
                    ctx.BASE_ProductOrder.DeleteAllOnSubmit(varOrder);
                    ctx.SubmitChanges();

                    int intOrder = 0;
                    foreach (View_S_DebitSchedule item in listInfo)
                    {
                        if (item.基数 > 0)
                        {
                            BASE_ProductOrder order = new BASE_ProductOrder();

                            order.Edition           = edition;
                            order.Applicable        = applicable.ToString();
                            order.GoodsID           = item.物品ID;
                            order.Redices           = item.基数;
                            order.OnceTheWholeIssue = item.一次性整台份发料;
                            order.Position          = ++intOrder;

                            ctx.BASE_ProductOrder.InsertOnSubmit(order);
                        }
                    }

                    ctx.SubmitChanges();
                }

                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 添加领料清单信息
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="order">添加的数据信息</param>
        /// <param name="applicable">适用范围</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>添加成功返回True,添加失败返回False</returns>
        private bool InsertDate(DepotManagementDataContext context, DataTable order, CE_DebitScheduleApplicable applicable, out string error)
        {
            error = null;

            try
            {
                List <BASE_ProductOrder> lisOrder = new List <BASE_ProductOrder>();

                if (order.Rows.Count == 0)
                {
                    return(true);
                }
                else
                {
                    for (int i = 0; i < order.Rows.Count; i++)
                    {
                        BASE_ProductOrder lnqOrder = new BASE_ProductOrder();

                        lnqOrder.Edition           = order.Rows[i]["产品编码"].ToString();
                        lnqOrder.Applicable        = applicable.ToString();
                        lnqOrder.GoodsID           = Convert.ToInt32(order.Rows[i]["物品ID"]);
                        lnqOrder.Redices           = Convert.ToDecimal(order.Rows[i]["基数"].ToString());
                        lnqOrder.Position          = Convert.ToInt32(order.Rows[i]["顺序位置"].ToString());
                        lnqOrder.OnceTheWholeIssue = Convert.ToBoolean(order.Rows[i]["一次性整台份发料"]);

                        lisOrder.Add(lnqOrder);
                    }

                    context.BASE_ProductOrder.InsertAllOnSubmit(lisOrder);
                }

                context.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }