/// <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; } }