/// <summary>
        /// 更新组柜明细状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public string UpdateDeliveryGroupStatus(string ids, int status)
        {
            try
            {
                string[] array = ids.Split(',');
                foreach (string id in array)
                {
                    ICSEOUTBILLENTRYMODEL model = ICSEOUTBILLENTRYDAL.Instance.Get(id);
                    if (model != null)
                    {
                        model.FGROUP_STATUS = status;
                    }
                    ICSEOUTBILLENTRYDAL.Instance.Update(model);

                    //更新请购计划数量
                    string             sql       = string.Format("SELECT SUM(FCOMMITQTY*FRATE) FROM V_ICSEOUTBILLENTRY WHERE FICPRID='{0}' and (FGROUP_STATUS is null or FGROUP_STATUS = 0)", model.FICPRID);
                    DataTable          table     = hn.Common.Data.DbUtils.Query(sql);
                    decimal            total     = hn.Common.PublicMethod.GetDecimal(table.Rows[0][0]);
                    ICPRBILLENTRYMODEL icprModel = ICPRBILLENTRYDAL.Instance.Get(model.FICPRID);
                    if (icprModel != null)
                    {
                        icprModel.FLEFTAMOUNT = icprModel.FASKQTY - total;

                        if (icprModel.FLEFTAMOUNT <= 0)
                        {
                            icprModel.FSTATUS = 5;
                        }
                        else
                        {
                            icprModel.FSTATUS = 7;
                        }

                        ICPRBILLENTRYDAL.Instance.Update(icprModel);

                        if (ICPRBILLENTRYDAL.Instance.GetCloseStatus(icprModel.FPLANID) == 0)
                        {
                            ICPRBILLDAL.Instance.UpdateWhatWhere(new { FSTATUS = (int)Constant.ICPRBILL_FSTATUS.关闭 }, new { FID = icprModel.FPLANID });
                        }
                        else
                        {
                            ICPRBILLDAL.Instance.UpdateWhatWhere(new { FSTATUS = (int)Constant.ICPRBILL_FSTATUS.采购确认 }, new { FID = icprModel.FPLANID });
                        }
                    }
                }

                return("");
            }
            catch (Exception ex)
            {
                hn.Common.LogHelper.WriteLog(ex);
                throw ex;
            }
        }
Exemple #2
0
 public int Add(ICSEOUTBILLENTRYMODEL model, string FID)
 {
     return(ICSEOUTBILLENTRYDAL.Instance.InsertWithFID(model, FID));
 }