SPServices 备忘 添加list记录

1 function NewJobProposalSaveJP(_status)
2 {
3 var JP_NUMBER = document.getElementById("TextBoxJPNumber").value;
4 var VENDER_LPM = document.getElementById("TextBoxVenderLPM").value;
5 var HP_LPM_Dropdownlist = document.getElementById("DropDownListHPLPM");
6 var HP_LPM = HP_LPM_Dropdownlist.options[HP_LPM_Dropdownlist.selectedIndex].value;
7 var PRODUCT_Dropdownlist = document.getElementById("DropDownListProject");
8 var PRODUCT = PRODUCT_Dropdownlist.options[PRODUCT_Dropdownlist.selectedIndex].value;
9 var PRODUCT_VERSION_Dropdownlist = document.getElementById("DropDownListVersion");
10 var PRODUCT_VERSION = PRODUCT_VERSION_Dropdownlist.options[PRODUCT_VERSION_Dropdownlist.selectedIndex].value;
11 var LANGUAGE_Dropdownlist = document.getElementById("DropDownListLanguage");
12 var LANGUAGE = LANGUAGE_Dropdownlist.options[LANGUAGE_Dropdownlist.selectedIndex].value;
13 var SOURCE_RECEIVE = document.getElementById("TextBoxSourceReceived").value;
14 var TARGET_DELIVERY = document.getElementById("TextBoxTargetDelivery").value;
15 var JOB_COMPONENT_Dropdownlist = document.getElementById("DropDownListComponent");
16 var JOB_COMPONENT = JOB_COMPONENT_Dropdownlist.options[JOB_COMPONENT_Dropdownlist.selectedIndex].value;
17 var JOB_TYPE_Dropdownlist = document.getElementById("DropDownListJPType");
18 var JOB_TYPE = JOB_TYPE_Dropdownlist.options[JOB_TYPE_Dropdownlist.selectedIndex].value;
19 var PO_NUMBER = document.getElementById("TextBoxPONumber").value;
20 var SUB_TOTAL = document.getElementById("TextBoxSubTotal").value;
21 var PROJECT_MGMT = document.getElementById("TextBoxProjectManagement").value;
22 var GRAND_TOTAL = document.getElementById("TextBoxGrandTotal").value;
23 var CONVERSION_RATE = document.getElementById("TextBoxConversionRate").value;
24 var JP_STATUS = _status;
25 var TASK_DESCRIPTION = document.getElementById("TextBoxTaskDescription").value;
26
27 if(!NewJobProposalCheckUniqueJP(JP_NUMBER))
28 {
29 //JP_NUMBER is used in list
30 NewJobProposalJPNumber(); //change JP_NUMBER;
31 return false;
32 }
33 //VENDER_LPM = "asiapacific\\bux";
34 // HP_LPM = "asiapacific\\bux";
35 var isSucceed = true;
36 $().SPServices({
37 operation: "UpdateListItems",
38 async: false,
39 batchCmd: "New",
40 listName: "m_job_proposal",
41 valuepairs: [
42 ["Title", JP_NUMBER],
43 ["VENDER_LPM", VENDER_LPM],
44 ["HP_LPM", HP_LPM],
45 ["PRODUCT", PRODUCT],
46 ["PRODUCT_VERSION", PRODUCT_VERSION],
47 ["LANGUAGE", LANGUAGE],
48 ["SOURCE_RECEIVE", SOURCE_RECEIVE],
49 ["TARGET_DELIVERY", TARGET_DELIVERY],
50 ["JOB_COMPONENT", JOB_COMPONENT],
51 ["JOB_TYPE", JOB_TYPE],
52 ["PO_NUMBER", PO_NUMBER],
53 ["SUB_TOTAL", SUB_TOTAL],
54 ["PROJECT_MGMT", PROJECT_MGMT],
55 ["GRAND_TOTAL", GRAND_TOTAL],
56 ["CONVERSION_RATE", CONVERSION_RATE],
57 ["JP_STATUS", JP_STATUS],
58 ["TASK_DESCRIPTION", TASK_DESCRIPTION]
59 ],
60 completefunc: function(xData, Status) {
61 if(Status != "success")
62 {
63 isSucceed = false;
64 }
65 }
66 });
67 if(!isSucceed)
68 {
69 //save JP failed
70 return isSucceed;
71 }
72
73 if(NewJobProposalSaveJPJobItems(JP_NUMBER))
74 {
75 //add jp history
76 $().SPServices({
77 operation: "UpdateListItems",
78 async: false,
79 batchCmd: "New",
80 listName: "m_job_proposal_history",
81 valuepairs: [
82 ["Title", JP_NUMBER],
83 ["JP_STATUS", _status.substring(_status.indexOf("#")+1)],
84 ["COMMENTS", "Create JP."]
85 ],
86 completefunc: function(xData, Status) {
87 if(Status != "success")
88 {
89 isSucceed = false;
90 }
91 }
92 });
93 NewJobProposalSaveJPLogFiles(document.getElementById("TextBoxJPNumber").value);
94 return true;
95 }
96 else
97 {
98 NewJobProposalDeleteJPByJP_NUMBER(JP_NUMBER);
99 NewJobProposalDeleteJPJobItemsByJP_NUMBER(JP_NUMBER);
100 return false;
101 }
102 }
posted @ 2011-05-17 16:16  lotteyang  阅读(545)  评论(0编辑  收藏  举报