コード例 #1
0
        /// <summary>
        /// 新增排产明细
        /// </summary>
        /// <param name="workDetail">排产明细</param>
        /// <param name="workModuleList">排产物料集合</param>
        /// <returns></returns>
        public Boolean save(work_detail workDetail, List <int> workModuleIdList)
        {
            workDetail.company = user.company;
            workDetail         = cd.save <work_detail>(workDetail);
            if (workDetail == null)
            {
                return(false);
            }

            //如果不是插单,填充row_num
            if (workDetail.is_insert == 0)
            {
                workDetail.row_num = workDetail.id + 1;
                if (!cd.update <work_detail>(workDetail))
                {
                    return(false);
                }
            }

            foreach (int workModuleId in workModuleIdList)
            {
                work_module workModule = new work_module();
                workModule.module_id = workModuleId;
                workModule.work_id   = workDetail.id;
                if (cd.save <work_module>(workModule) == null)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
ファイル: work.asmx.cs プロジェクト: yhltd/YH_jinxiaocun_PC
        public string save(work_detail workDetail, List <int> workModuleIdList)
        {
            using (TransactionScope tran = new TransactionScope())
            {
                try
                {
                    UserInfoService us             = new UserInfoService();
                    string          quanxian_save1 = us.new_quanxian("add", "排产");
                    if (quanxian_save1 != null && quanxian_save1.Length > 0 && quanxian_save1 == "是")
                    {
                    }
                    else
                    {
                        return(ResultUtil.error("没有权限!"));
                    }

                    wds = new WorkDetailService();
                    if (wds.save(workDetail, workModuleIdList))
                    {
                        tran.Complete();
                        return(ResultUtil.success("添加成功"));
                    }
                    else
                    {
                        return(ResultUtil.success("添加失败"));
                    }
                }
                catch (ErrorUtil err)
                {
                    return(ResultUtil.fail(401, err.Message));
                }
                catch
                {
                    return(ResultUtil.error("添加失败"));
                }
            }
        }