Exemple #1
0
        public void Edit(dynamic data)
        {
            var service = new MES_WorkshopPurchaseMainService();

            if (data.form["WorkshopPurchaseCode"] != "系统生成")
            {
                var pQuery = ParamQuery.Instance().Select("*").AndWhere("ID", data.form["ID"]);
                MES_WorkshopPurchaseMain model = service.GetModel(pQuery);
                if (model.ApproveState != null && model.ApproveState == "2")
                {
                    MmsHelper.ThrowHttpExceptionWhen(true, "已发布的不能修改!");
                    return;
                }
            }


            var formWrapper = RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>
        MES_WorkshopPurchaseMain
    </table>
    <where>
        <field name='ID' cp='equal'></field>
    </where>
</settings>
");

            var tabsWrapper = new List <RequestWrapper>();

            tabsWrapper.Add(RequestWrapper.Instance().LoadSettingXmlString(@"
<settings>
    <table>MES_WorkshopPurchaseDetail</table>
    <where>
        <field name='ID' cp='equal'></field>      
    </where>
</settings>"));
            if (data.form["WorkshopPurchaseCode"] == "系统生成")
            {
                string documentNo = MmsHelper.GetOrderNumber("MES_WorkshopPurchaseMain", "WorkshopPurchaseCode", "CJQG", "", "");
                data.form["WorkshopPurchaseCode"] = documentNo;
            }
            var result = service.EditPage(data, formWrapper, tabsWrapper);
        }
Exemple #2
0
        public dynamic GetPageData(string id)
        {
            var masterService = new MES_WorkshopPurchaseMainService();
            var pQuery        = ParamQuery.Instance().AndWhere("ID", id);
            var pQuery2       = ParamQuery.Instance().AndWhere("MainID", id);
            //var form = masterService.GetModel(pQuery);
            //form.CreateTime=Convert.ToDateTime? form.CreateTime.ToString("yyyy-mm-dd");
            var result = new
            {
                //主表数据
                form       = masterService.GetModel(pQuery),
                scrollKeys = masterService.ScrollKeys("ID", id),

                //明细数据
                tab0 = new MES_WorkshopPurchaseDetailService().GetDynamicList(pQuery2)
            };

            return(result);
        }