public static bool RunSubDeliverySendOut(SubDeliverySend model, List<SubDeliverySendDetail> modelList)
        {
            ArrayList SqlList = new ArrayList();

            #region 配送明细单
            StringBuilder sbDel = new StringBuilder();
            sbDel.Append("DELETE officedba.SubDeliverySendDetail WHERE CompanyCD=@CompanyCD AND SendNo=@SendNo");
            SqlParameter[] delParas = { 
                                          new SqlParameter("@CompanyCD",SqlDbType.VarChar),
                                          new SqlParameter("@SendNo",SqlDbType.VarChar)
                                      };
            delParas[0].Value = model.CompanyCD;
            delParas[1].Value = model.SendNo;
            SqlCommand sqlDelCmd = new SqlCommand { CommandText = sbDel.ToString() };
            sqlDelCmd.Parameters.AddRange(delParas);
            SqlList.Add(sqlDelCmd);
            foreach (Model.Office.LogisticsDistributionManager.SubDeliverySendDetail m in modelList)
            {

                SqlList.Add(SaveDetail(m));

                #region 添加门店库存流水帐

                XBase.Model.Office.StorageManager.StorageAccountModel sModel = new XBase.Model.Office.StorageManager.StorageAccountModel();
                sModel.BatchNo = m.BatchNo;
                sModel.BillNo = m.SendNo;
                sModel.BillType = 19;
                sModel.CompanyCD = m.CompanyCD;
                sModel.StorageID = m.StorageID.Value;
                sModel.ProductID = m.ProductID.Value;
                sModel.Creator = model.Creator.Value;
                sModel.HappenDate = DateTime.Now;
                sModel.Price = m.SendPrice.Value;
                sModel.HappenCount = m.SendCount.Value;
                sModel.PageUrl = model.Remark;
                SqlList.Add(XBase.Data.Office.StorageManager.StorageAccountDBHelper.InsertStorageAccountCommand(sModel, "1"));

                #endregion

                // 更新库存
                SqlList.Add(XBase.Data.Office.StorageManager.StorageSearchDBHelper.UpdateProductCount(m.CompanyCD, m.ProductID.ToString(), m.StorageID.ToString()
                    , m.BatchNo, -m.SendCount.Value));
            }
            #endregion

            #region 更新配送单
            StringBuilder sbMainSql = new StringBuilder();
            sbMainSql.Append("UPDATE  officedba.SubDeliverySend SET OutUserID=@OutUserID,OutDate=@OutDate,BusiStatus=@BusiStatus ,");
            sbMainSql.Append("SendPrice=@SendPrice,SendCount=@SendCount ");
            sbMainSql.Append(" WHERE ID=@ID ");
            SqlParameter[] MainParas = { 
                                           new SqlParameter("@OutUserID",SqlDbType.Int),
                                           new SqlParameter("@OutDate",SqlDbType.DateTime),
                                           new SqlParameter("@BusiStatus",SqlDbType.VarChar),
                                           new SqlParameter("@ID",SqlDbType.Int),
                                           new SqlParameter("@SendPrice",SqlDbType.Decimal),
                                           new SqlParameter("@SendCount",SqlDbType.Decimal)
                                       };
            MainParas[0].Value = model.OutUserID;
            MainParas[1].Value = model.OutDate;
            MainParas[2].Value = model.BusiStatus;
            MainParas[3].Value = model.ID;
            MainParas[4].Value = model.SendPrice;
            MainParas[5].Value = model.SendCount;
            SqlCommand SqlMainCmd = new SqlCommand() { CommandText = sbMainSql.ToString() };
            SqlMainCmd.Parameters.AddRange(MainParas);
            SqlList.Add(SqlMainCmd);
            #endregion

            return SqlHelper.ExecuteTransWithArrayList(SqlList);

        }
        public static bool RukuSubSellBack(SubSellBackModel model, string DetailBackCount, string DetailStorageID, string DetailProductID, string DetailUnitPrice, string DetailBatchNo, string length)
        {
            #region 入库单据
            ArrayList listADD = new ArrayList();
            bool result = false;
            StringBuilder strSql = new StringBuilder();
            if (model.PayedTotal != model.WairPayTotal)
            {
                strSql.AppendLine("update officedba.SubSellBack set ");
                strSql.AppendLine(" InUserID=@InUserID");
                strSql.AppendLine(" ,InDate=@InDate");
                strSql.AppendLine(" ,BillStatus=@BillStatus");
                strSql.AppendLine(" ,BusiStatus=@BusiStatus");
                strSql.AppendLine(" ,PayedTotal=@PayedTotal");
                strSql.AppendLine(" ,WairPayTotal=@WairPayTotal");
                strSql.AppendLine(" where");
                strSql.AppendLine(" CompanyCD=@CompanyCD");
                strSql.AppendLine(" and ID=@ID");
                SqlCommand comm = new SqlCommand();
                comm.Parameters.Add(SqlHelper.GetParameter("@InUserID", model.InUserID));
                comm.Parameters.Add(SqlHelper.GetParameter("@InDate", model.InDate == null
                                                            ? SqlDateTime.Null
                                                            : SqlDateTime.Parse(model.InDate.ToString())));
                comm.Parameters.Add(SqlHelper.GetParameter("@BillStatus", model.BillStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@BusiStatus", model.BusiStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@PayedTotal", model.PayedTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@WairPayTotal", model.WairPayTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
                comm.CommandText = strSql.ToString();

                listADD.Add(comm);
            }
            else
            {
                strSql.AppendLine("update officedba.SubSellBack set ");
                strSql.AppendLine(" InUserID=@InUserID");
                strSql.AppendLine(" ,InDate=@InDate");
                strSql.AppendLine(" ,Closer=@Closer");
                strSql.AppendLine(" ,CloseDate=getdate()");
                strSql.AppendLine(" ,BillStatus=@BillStatus");
                strSql.AppendLine(" ,BusiStatus=@BusiStatus");
                strSql.AppendLine(" ,PayedTotal=@PayedTotal");
                strSql.AppendLine(" ,WairPayTotal=@WairPayTotal");
                strSql.AppendLine(" where");
                strSql.AppendLine(" CompanyCD=@CompanyCD");
                strSql.AppendLine(" and ID=@ID");
                SqlCommand comm = new SqlCommand();
                comm.Parameters.Add(SqlHelper.GetParameter("@InUserID", model.InUserID));
                comm.Parameters.Add(SqlHelper.GetParameter("@InDate", model.InDate == null
                                                            ? SqlDateTime.Null
                                                            : SqlDateTime.Parse(model.InDate.ToString())));
                comm.Parameters.Add(SqlHelper.GetParameter("@Closer", model.Closer));
                comm.Parameters.Add(SqlHelper.GetParameter("@BillStatus", model.BillStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@BusiStatus", model.BusiStatus));
                comm.Parameters.Add(SqlHelper.GetParameter("@PayedTotal", model.PayedTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@WairPayTotal", model.WairPayTotal));
                comm.Parameters.Add(SqlHelper.GetParameter("@CompanyCD", model.CompanyCD));
                comm.Parameters.Add(SqlHelper.GetParameter("@ID", model.ID));
                comm.CommandText = strSql.ToString();

                listADD.Add(comm);
            }
            #endregion

            #region 入库时回写响应模块的退货数量
            try
            {

                int id = 0;
                decimal count = 0m;
                if (model.SendMode == "1")
                {//分店发货,更新分店的存量表中的现有存量,增加相应物品的退货数量
                    int lengs = Convert.ToInt32(length);
                    if (lengs > 0)
                    {
                        string[] BackCount = DetailBackCount.Split(',');
                        string[] ProductID = DetailProductID.Split(',');
                        string[] UnitPrice = DetailUnitPrice.Split(',');
                        string[] BatchNo = DetailBatchNo.Split(',');
                        for (int i = 0; i < lengs; i++)
                        {
                            #region 添加门店库存流水帐
                            SubStorageAccountModel aModel = new SubStorageAccountModel();
                            aModel.BatchNo = BatchNo[i];
                            aModel.BillNo = model.BackNo;
                            aModel.BillType = 4;
                            aModel.CompanyCD = model.CompanyCD;
                            aModel.Creator = model.Closer;
                            aModel.DeptID = model.DeptID;
                            aModel.HappenDate = DateTime.Now;
                            if (int.TryParse(ProductID[i], out id))
                            {
                                aModel.ProductID = id;
                            }
                            if (decimal.TryParse(UnitPrice[i], out count))
                            {
                                aModel.Price = count;
                            }
                            if (decimal.TryParse(BackCount[i], out count))
                            {
                                aModel.HappenCount = count;
                            }
                            aModel.PageUrl = model.Remark;
                            listADD.Add(XBase.Data.Office.SubStoreManager.SubStorageAccountDBHelper.GetCountAndInsertCommand(aModel));
                            #endregion

                            // 更新库存
                            listADD.Add(XBase.Data.Office.LogisticsDistributionManager.StorageProductQueryDBHelper.UpdateProductCount(model.CompanyCD
                                        , ProductID[i], model.DeptID.ToString(), BatchNo[i], count));
                        }
                    }
                }
                else
                {//总部发货,更新总部的分仓存量表中的现有存量,增加相应物品的退货数量
                    int lengs = Convert.ToInt32(length);
                    if (lengs > 0)
                    {
                        string[] BackCount = DetailBackCount.Split(',');
                        string[] StorageID = DetailStorageID.Split(',');
                        string[] ProductID = DetailProductID.Split(',');
                        string[] UnitPrice = DetailUnitPrice.Split(',');
                        string[] BatchNo = DetailBatchNo.Split(',');
                        for (int i = 0; i < lengs; i++)
                        {
                            #region 添加库存流水帐

                            XBase.Model.Office.StorageManager.StorageAccountModel sModel = new XBase.Model.Office.StorageManager.StorageAccountModel();
                            sModel.BatchNo = BatchNo[i];
                            sModel.BillNo = model.BackNo;
                            sModel.BillType = 22;
                            sModel.CompanyCD = model.CompanyCD;
                            sModel.Creator = model.Closer;
                            if (int.TryParse(StorageID[i], out id))
                            {
                                sModel.StorageID = id;
                            }
                            if (int.TryParse(ProductID[i], out id))
                            {
                                sModel.ProductID = id;
                            }
                            if (decimal.TryParse(UnitPrice[i], out count))
                            {
                                sModel.Price = count;
                            }
                            if (decimal.TryParse(BackCount[i], out count))
                            {
                                sModel.HappenCount = count;
                            }
                            sModel.HappenDate = DateTime.Now;
                            sModel.PageUrl = model.Remark;
                            listADD.Add(XBase.Data.Office.StorageManager.StorageAccountDBHelper.InsertStorageAccountCommand(sModel, "0"));

                            #endregion

                            // 更新库存
                            listADD.Add(XBase.Data.Office.StorageManager.StorageSearchDBHelper.UpdateProductCount(model.CompanyCD, ProductID[i], StorageID[i], BatchNo[i], count));

                        }
                    }
                }

                if (SqlHelper.ExecuteTransWithArrayList(listADD))
                {
                    result = true;
                }
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            #endregion

        }
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="SubSellOrderM"></param>
        /// <param name="SubSellOrderDetailMList"></param>
        /// <returns></returns>
        public static bool ConfirmOutSubSellOrder(SubSellOrderModel SubSellOrderM, List<SubSellOrderDetailModel> SubSellOrderDetailMList)
        {
            try
            {
                ArrayList lstConfirm = new ArrayList();
                UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                int id = 0;
                decimal count = 0m;
                if (SubSellOrderM.SendMode == "1")
                {//分店发货
                    //确认时,更新分店存量表
                    foreach (SubSellOrderDetailModel SubSellOrderDetailM in SubSellOrderDetailMList)
                    {
                        #region 添加门店库存流水帐
                        SubStorageAccountModel aModel = new SubStorageAccountModel();
                        aModel.BatchNo = SubSellOrderDetailM.BatchNo;
                        aModel.BillNo = SubSellOrderM.OrderNo;
                        aModel.BillType = 3;
                        aModel.CompanyCD = SubSellOrderDetailM.CompanyCD;
                        aModel.PageUrl = "";
                        if (int.TryParse(SubSellOrderM.Creator, out id))
                        {
                            aModel.Creator = id;
                        }
                        if (int.TryParse(SubSellOrderM.DeptID, out id))
                        {
                            aModel.DeptID = id;
                        }
                        aModel.HappenDate = DateTime.Now;
                        if (int.TryParse(SubSellOrderDetailM.ProductID, out id))
                        {
                            aModel.ProductID = id;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.UnitPrice, out count))
                        {
                            aModel.Price = count;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.ProductCount, out count))
                        {
                            aModel.HappenCount = -count;
                        }
                        aModel.PageUrl = SubSellOrderM.Remark;
                        lstConfirm.Add(XBase.Data.Office.SubStoreManager.SubStorageAccountDBHelper.GetCountAndInsertCommand(aModel));
                        #endregion

                        lstConfirm.Add(XBase.Data.Office.LogisticsDistributionManager.StorageProductQueryDBHelper.UpdateProductCount(userInfo.CompanyCD
                            , SubSellOrderDetailM.ProductID, SubSellOrderM.DeptID, SubSellOrderDetailM.BatchNo, -count));
                    }
                }
                else if (SubSellOrderM.SendMode == "2")
                {//总部发货
                    //确认时更新分仓存量表
                    foreach (SubSellOrderDetailModel SubSellOrderDetailM in SubSellOrderDetailMList)
                    {
                        #region 添加库存流水帐

                        XBase.Model.Office.StorageManager.StorageAccountModel sModel = new XBase.Model.Office.StorageManager.StorageAccountModel();
                        sModel.BatchNo = SubSellOrderDetailM.BatchNo;
                        sModel.BillNo = SubSellOrderM.OrderNo;
                        sModel.BillType = 21;
                        sModel.CompanyCD = SubSellOrderDetailM.CompanyCD;
                        if (int.TryParse(SubSellOrderDetailM.StorageID, out id))
                        {
                            sModel.StorageID = id;
                        }
                        if (int.TryParse(SubSellOrderM.Creator, out id))
                        {
                            sModel.Creator = id;
                        }
                        if (int.TryParse(SubSellOrderDetailM.ProductID, out id))
                        {
                            sModel.ProductID = id;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.UnitPrice, out count))
                        {
                            sModel.Price = count;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.ProductCount, out count))
                        {
                            sModel.HappenCount = count;
                        }
                        sModel.HappenDate = DateTime.Now;
                        sModel.PageUrl = SubSellOrderM.Remark;
                        lstConfirm.Add(XBase.Data.Office.StorageManager.StorageAccountDBHelper.InsertStorageAccountCommand(sModel, "1"));

                        #endregion

                        // 更新库存
                        lstConfirm.Add(XBase.Data.Office.StorageManager.StorageSearchDBHelper.UpdateProductCount(userInfo.CompanyCD
                            , SubSellOrderDetailM.ProductID, SubSellOrderDetailM.StorageID
                            , SubSellOrderDetailM.BatchNo, -count));
                    }
                }

                //更新发货信息和安装信息
                lstConfirm.Add(SubSellOrderDBHelper.ConfirmOutSubSellOrder(SubSellOrderM));

                //获取登陆用户信息
                //UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;
                /* 
                 * 定义日志内容变量 
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstConfirm);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识 
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

                LogInfoModel logModel = InitLogInfo(SubSellOrderM.OrderNo);
                //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                logModel.Element = ConstUtil.LOG_PROCESS_OUT;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return isSucc;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public static bool SubDeliveryBackIn(SubDeliveryBack model, List<SubDeliveryBackDetail> modelList)
        {
            ArrayList SqlList = new ArrayList();

            #region 更新配送单信息
            StringBuilder sbMainSql = new StringBuilder();
            sbMainSql.Append("UPDATE officedba.SubDeliveryBack SET InUserID=@InUserID , InDate=@InDate ,BusiStatus=@BusiStatus ");
            sbMainSql.Append(" where ID=@ID");
            SqlParameter[] MainParas = { 
                                           new SqlParameter("@InUserID",SqlDbType.Int),
                                           new SqlParameter("@InDate",SqlDbType.DateTime),
                                           new SqlParameter("@BusiStatus",SqlDbType.VarChar),
                                           new SqlParameter("@ID",SqlDbType.Int)};
            MainParas[0].Value = model.InUserID;
            MainParas[1].Value = model.InDate;
            MainParas[2].Value = model.BusiStatus;
            MainParas[3].Value = model.ID;
            SqlCommand SqlMainCmd = new SqlCommand() { CommandText = sbMainSql.ToString() };
            SqlMainCmd.Parameters.AddRange(MainParas);
            SqlList.Add(SqlMainCmd);
            #endregion

            StringBuilder sbSubDelSql = new StringBuilder();
            sbSubDelSql.Append("DELETE officedba.SubDeliveryBackDetail WHERE   ");
            sbSubDelSql.Append(" BackNo=@BackNo AND CompanyCD=@CompanyCD ");
            SqlParameter[] delParas = { 
                                          new SqlParameter("@BackNo",SqlDbType.VarChar),
                                          new SqlParameter("@CompanyCD",SqlDbType.VarChar)};
            delParas[0].Value = model.BackNo;
            delParas[1].Value = model.CompanyCD;
            SqlCommand sqlDelCmd = new SqlCommand() { CommandText = sbSubDelSql.ToString() };
            sqlDelCmd.Parameters.AddRange(delParas);
            SqlList.Add(sqlDelCmd);


            /*如果单据有源单 则回写源单退货数量*/
            if (model.SendID > 0)
            {
                StringBuilder sbSetSendSql = new StringBuilder();
                sbSetSendSql.Append("UPDATE officedba.SubDeliverySend SET BackCount=(isnull(BackCount,0)+@BackCount)  ");
                sbSetSendSql.Append(" where ID=@ID");
                SqlParameter[] setSendParas = { 
                                                  new SqlParameter("@BackCount",SqlDbType.Decimal),
                                                  new SqlParameter("@ID",SqlDbType.Int)};
                setSendParas[0].Value = model.BackCount;
                setSendParas[1].Value = model.SendID;

                SqlCommand sqlSetSendCmd = new SqlCommand() { CommandText = sbSetSendSql.ToString() };
                sqlSetSendCmd.Parameters.AddRange(setSendParas);
                SqlList.Add(sqlSetSendCmd);
            }

            foreach (SubDeliveryBackDetail m in modelList)
            {
                SqlList.Add(GetSaveDetail(m));

                #region 添加门店库存流水帐
                XBase.Model.Office.StorageManager.StorageAccountModel sModel = new XBase.Model.Office.StorageManager.StorageAccountModel();
                sModel.BatchNo = m.BackBatchNo;
                sModel.BillNo = m.BackNo;
                sModel.BillType = 20;
                sModel.CompanyCD = m.CompanyCD;
                sModel.StorageID = m.StorageID.Value;
                sModel.ProductID = m.ProductID.Value;
                sModel.Creator = model.Creator.Value;
                sModel.HappenDate = DateTime.Now;
                sModel.Price = m.BackPrice.Value;
                sModel.HappenCount = m.BackCount.Value;
                sModel.PageUrl = model.Remark;
                SqlList.Add(XBase.Data.Office.StorageManager.StorageAccountDBHelper.InsertStorageAccountCommand(sModel, "0"));
                #endregion

                #region 入库操作
                SqlList.Add(XBase.Data.Office.StorageManager.StorageSearchDBHelper.UpdateProductCount(m.CompanyCD, m.ProductID.ToString(), m.StorageID.ToString(), m.BackBatchNo, m.BackCount.Value));
                #endregion

            }
            return SqlHelper.ExecuteTransWithArrayList(SqlList);
        }
Beispiel #5
0
        /// <summary>
        /// 确认
        /// </summary>
        /// <param name="SubSellOrderM"></param>
        /// <param name="SubSellOrderDetailMList"></param>
        /// <returns></returns>
        public static bool ConfirmOutSubSellOrder(SubSellOrderModel SubSellOrderM, List <SubSellOrderDetailModel> SubSellOrderDetailMList)
        {
            try
            {
                ArrayList    lstConfirm = new ArrayList();
                UserInfoUtil userInfo   = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                int          id         = 0;
                decimal      count      = 0m;
                if (SubSellOrderM.SendMode == "1")
                {//分店发货
                    //确认时,更新分店存量表
                    foreach (SubSellOrderDetailModel SubSellOrderDetailM in SubSellOrderDetailMList)
                    {
                        #region 添加门店库存流水帐
                        SubStorageAccountModel aModel = new SubStorageAccountModel();
                        aModel.BatchNo   = SubSellOrderDetailM.BatchNo;
                        aModel.BillNo    = SubSellOrderM.OrderNo;
                        aModel.BillType  = 3;
                        aModel.CompanyCD = SubSellOrderDetailM.CompanyCD;
                        aModel.PageUrl   = "";
                        if (int.TryParse(SubSellOrderM.Creator, out id))
                        {
                            aModel.Creator = id;
                        }
                        if (int.TryParse(SubSellOrderM.DeptID, out id))
                        {
                            aModel.DeptID = id;
                        }
                        aModel.HappenDate = DateTime.Now;
                        if (int.TryParse(SubSellOrderDetailM.ProductID, out id))
                        {
                            aModel.ProductID = id;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.UnitPrice, out count))
                        {
                            aModel.Price = count;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.ProductCount, out count))
                        {
                            aModel.HappenCount = -count;
                        }
                        aModel.PageUrl = SubSellOrderM.Remark;
                        lstConfirm.Add(XBase.Data.Office.SubStoreManager.SubStorageAccountDBHelper.GetCountAndInsertCommand(aModel));
                        #endregion

                        lstConfirm.Add(XBase.Data.Office.LogisticsDistributionManager.StorageProductQueryDBHelper.UpdateProductCount(userInfo.CompanyCD
                                                                                                                                     , SubSellOrderDetailM.ProductID, SubSellOrderM.DeptID, SubSellOrderDetailM.BatchNo, -count));
                    }
                }
                else if (SubSellOrderM.SendMode == "2")
                {//总部发货
                    //确认时更新分仓存量表
                    foreach (SubSellOrderDetailModel SubSellOrderDetailM in SubSellOrderDetailMList)
                    {
                        #region 添加库存流水帐

                        XBase.Model.Office.StorageManager.StorageAccountModel sModel = new XBase.Model.Office.StorageManager.StorageAccountModel();
                        sModel.BatchNo   = SubSellOrderDetailM.BatchNo;
                        sModel.BillNo    = SubSellOrderM.OrderNo;
                        sModel.BillType  = 21;
                        sModel.CompanyCD = SubSellOrderDetailM.CompanyCD;
                        if (int.TryParse(SubSellOrderDetailM.StorageID, out id))
                        {
                            sModel.StorageID = id;
                        }
                        if (int.TryParse(SubSellOrderM.Creator, out id))
                        {
                            sModel.Creator = id;
                        }
                        if (int.TryParse(SubSellOrderDetailM.ProductID, out id))
                        {
                            sModel.ProductID = id;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.UnitPrice, out count))
                        {
                            sModel.Price = count;
                        }
                        if (decimal.TryParse(SubSellOrderDetailM.ProductCount, out count))
                        {
                            sModel.HappenCount = count;
                        }
                        sModel.HappenDate = DateTime.Now;
                        sModel.PageUrl    = SubSellOrderM.Remark;
                        lstConfirm.Add(XBase.Data.Office.StorageManager.StorageAccountDBHelper.InsertStorageAccountCommand(sModel, "1"));

                        #endregion

                        // 更新库存
                        lstConfirm.Add(XBase.Data.Office.StorageManager.StorageSearchDBHelper.UpdateProductCount(userInfo.CompanyCD
                                                                                                                 , SubSellOrderDetailM.ProductID, SubSellOrderDetailM.StorageID
                                                                                                                 , SubSellOrderDetailM.BatchNo, -count));
                    }
                }

                //更新发货信息和安装信息
                lstConfirm.Add(SubSellOrderDBHelper.ConfirmOutSubSellOrder(SubSellOrderM));

                //获取登陆用户信息
                //UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
                //定义返回变量
                bool isSucc = false;

                /*
                 * 定义日志内容变量
                 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
                 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
                 */

                //执行插入操作
                try
                {
                    isSucc = SqlHelper.ExecuteTransWithArrayList(lstConfirm);
                }
                catch (Exception ex)
                {
                    //输出日志
                    WriteSystemLog(userInfo, ex);
                }
                //定义变量
                string remark;
                //成功时
                if (isSucc)
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_SUCCESS;
                }
                else
                {
                    //设置操作成功标识
                    remark = ConstUtil.LOG_PROCESS_FAILED;
                }

                LogInfoModel logModel = InitLogInfo(SubSellOrderM.OrderNo);
                //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                logModel.Element = ConstUtil.LOG_PROCESS_OUT;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
                return(isSucc);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }