047 Medical Project-Module IV: Purchase order module-Purchase Order approval submission (dao,service,action three floor)

Source: Internet
Author: User

We have reviewed the purchase order before, this article is to submit after the audit.

is to change (update) The audit status of the purchase order.

Demand:

The user must first view the contents of the purchase order.

View Purchase Order page: page layout with Purchase order modification page.

Select the audit results, fill in the audit comments to submit.

Constraint conditions:

The status of the purchase order is audited and the Chinese can submit the audit.

Audit results (approved, approved, not approved) must be selected.

Audit opinion is required according to user needs to determine, the system is not required to fill.

Database operations:

Update purchase order status for approval or approval not approved.

DAO Layer:

Mapper generated using reverse engineering:

Yycgdmapper.updatebyprimarykeyselective (yycgd_update);

Service Layer:

@Override Public voidSaveyycgdcheckstatus (String yycgdid, Yycgdcustom yycgdcustom)throwsException {//Check the purchase orderYYCGD yycgd= This. Findyycgdbyid (Yycgdid); //If there is no such purchase order at all:    if(yycgd==NULL) {resultutil.throwexcepion (Resultutil.createfail (Config.message,514,NULL)); } String ZT=yycgd.getzt ();//get the status of the purchase order    if(!zt.equals ("2"))//If the purchasing status of the purchase order is not in this state of approval{resultutil.throwexcepion (Resultutil.createfail (Config.message,514,NULL)); }    //The result of the audit must be selected, otherwise it cannot be submitted    if(yycgdcustom==NULL|| yycgdcustom.getzt () = =NULL|| (!yycgdcustom.getzt (). Equals ("3") &&yycgdcustom.getzt (). Equals ("4")) {resultutil.throwexcepion (Resultutil.createfail (Config.message,514,NULL)); } String bussinessyear=yycgdid.substring (0,4); YYCGD Yycgd_updata=NewYYCGD ();        Yycgd_updata.setid (Yycgdid); //Update Statusyycgd_updata.setzt (yycgdcustom.getzt ()); //Update Audit TimeYycgd_updata.setshtime (NewDate ()); Yycgd_updata.setbusinessyear (bussinessyear); Yycgdmapper.updatebyprimarykeyselective (Yycgd_updata) ;//Update    }

Action Layer;

//Purchase Order Approval submission@RequestMapping ("/checkcgdsubmit")         Public@ResponseBody submitresultinfo checkcgdsubmit (Yycgdqueryvo yycgdqueryvo,int[] Indexs//page Select serial number)throwsException {//page submitted business data (multiple), business data to be processed, parameters passed in the pagelist<yycgdcustom> list =yycgdqueryvo.getyycgdcustoms (); //total number of processed data            intCount =indexs.length; //number of processing successes            intcount_success = 0; //number of processing failures            intCount_error = 0; //reason for processing failureList<resultinfo> Msgs_error =NewArraylist<resultinfo>();  for(inti = 0; I < count; i++) {Resultinfo resultinfo=NULL; //gets the business data to be processed (single) based on the ordinal of the selected rowYycgdcustom Yycgdcustom =List.get (Indexs[i]); //Purchase Order IDString Yycgdid =Yycgdcustom.getid (); Try{yycdgservice.saveyycgdcheckstatus (Yycgdid, Yycgdcustom); } Catch(Exception e) {e.printstacktrace (); //Perform exception resolution                    if(Einstanceofexceptionresultinfo) {Resultinfo=((Exceptionresultinfo) e). Getresultinfo (); } Else {                        //constructs an unknown error exceptionResultinfo = Resultutil.createfail (config.message, 900,                                NULL); }                }                if(Resultinfo = =NULL) {                    //Description Successcount_success++; } Else{count_error++; //record the reason for failureMsgs_error.add (Resultinfo); }            }            //Prompt user for number of successes, number of failures, reason for failure//change to return details            returnResultutil.createsubmitresult (resultutil.createsuccess (Config.message,907,Newobject[] {count_success, count_error}), Msgs_error); }        //Purchase Order Processing page@RequestMapping ("/DISPOSEYYCGD")         PublicString DISPOSEYYCGD (model model)throwsException {//Current yearModel.addattribute ("Year", Myutil.get_yyyy (Myutil.getdate ())); return"/BUSINESS/CGD/DISPOSEYYCGD"; }

Page:

{"icon": "Icon-log", "MenuID": "1_1", "Menuname": "Purchase Order Approval", "url": "/yycgproject/cgd/checkyycgdlist.action"
},

Debug through!!!

047 Medical Project-Module IV: Purchase order module-Purchase Order approval submission (dao,service,action three floor)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.