|
@@ -0,0 +1,768 @@
|
|
|
+/************* 采购管理 *********************/
|
|
|
+var ActionXML = "Action.xml";
|
|
|
+var P_Server = "PurchaseSrv.aspx";
|
|
|
+var S_Server = "StockSrv.aspx";
|
|
|
+var I_Server = "IngredientsSrv.aspx";
|
|
|
+var Supply_Server = "SupplySrv.aspx";
|
|
|
+
|
|
|
+/***************** document.ready start ********************/
|
|
|
+$(document).ready(function () {
|
|
|
+
|
|
|
+ /***************** 采购管理开始 ******************/
|
|
|
+ $("#purchase").bind("click", function () {
|
|
|
+ //构造 采购管理DIV
|
|
|
+ Left_Menu_Click("purchase", "采购管理", true);
|
|
|
+ getAllPurchase();
|
|
|
+ //采购管理 新增按钮点击事件
|
|
|
+ $("#Insert_purchase").bind("click", function () {
|
|
|
+ //构造 新增采购管理DIV
|
|
|
+ ActionDiv("Insert", "purchase", "新增采购管理");
|
|
|
+ //读取XML 获取新增表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Insert_Con_purchase").html($(data).find("Action[name='Insertpurchase']").html());
|
|
|
+ $("#purchaseSave").unbind();
|
|
|
+ $("#purchaseSave").bind("click", function () {
|
|
|
+ purchaseSaveClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义采购管理 新增按钮点击事件
|
|
|
+ $("#Insert_purchase").unbind();
|
|
|
+ $("#Insert_purchase").bind("click", function () {
|
|
|
+ Show_Action_Box("Insertpurchase");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //采购管理 修改按钮点击事件
|
|
|
+ $("#Update_purchase").bind("click", function () {
|
|
|
+ var id = CheckBoxVal("purchaseSTD");
|
|
|
+ if (id == "" || id.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的采购信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //构造 修改采购管理DIV
|
|
|
+ ActionDiv("Update", "purchase", "修改采购管理");
|
|
|
+ //读取XML 获取修改表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Update_Con_purchase").html($(data).find("Action[name='Updatepurchase']").html());
|
|
|
+ GetPVal(id);
|
|
|
+ $("#purchaseUpdate").unbind();
|
|
|
+ $("#purchaseUpdate").bind("click", function () {
|
|
|
+ purchaseUpdateClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义采购管理 修改按钮点击事件
|
|
|
+ $("#Update_purchase").unbind();
|
|
|
+ $("#Update_purchase").bind("click", function () {
|
|
|
+ var id2 = CheckBoxVal("purchaseSTD");
|
|
|
+ if (id2 == "" || id2.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的采购信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ GetPVal(id2);
|
|
|
+ Show_Action_Box("Updatepurchase");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //绑定搜索按钮点击事件
|
|
|
+ $("#searchB_purchase").unbind();
|
|
|
+ $("#searchB_purchase").bind("click", function () {
|
|
|
+ getAllPurchase();
|
|
|
+ });
|
|
|
+ //绑定删除按钮点击事件
|
|
|
+ $("#Del_purchase").unbind();
|
|
|
+ $("#Del_purchase").bind("click", function () {
|
|
|
+ PurchaseDelClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ /***************** 采购管理结束 ******************/
|
|
|
+
|
|
|
+ /***************** 库存管理开始 ******************/
|
|
|
+ $("#stock").bind("click", function () {
|
|
|
+ //构造 库存管理DIV
|
|
|
+ Left_Menu_Click("stock", "库存管理", true);
|
|
|
+ getAllStock();
|
|
|
+ //库存管理 新增按钮点击事件
|
|
|
+ $("#Insert_stock").bind("click", function () {
|
|
|
+ //构造 新增库存管理DIV
|
|
|
+ ActionDiv("Insert", "stock", "新增库存管理");
|
|
|
+ //读取XML 获取新增表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Insert_Con_stock").html($(data).find("Action[name='Insertstock']").html());
|
|
|
+ $("#stockSave").unbind();
|
|
|
+ $("#stockSave").bind("click", function () {
|
|
|
+ stockSaveClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义库存管理 新增按钮点击事件
|
|
|
+ $("#Insert_stock").unbind();
|
|
|
+ $("#Insert_stock").bind("click", function () {
|
|
|
+ Show_Action_Box("Insertstock");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //库存管理 修改按钮点击事件
|
|
|
+ $("#Update_stock").bind("click", function () {
|
|
|
+ var id = CheckBoxVal("stockSTD");
|
|
|
+ if (id == "" || id.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的库存信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //构造 修改库存管理DIV
|
|
|
+ ActionDiv("Update", "stock", "修改库存管理");
|
|
|
+ //读取XML 获取修改表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Update_Con_stock").html($(data).find("Action[name='Updatestock']").html());
|
|
|
+ GetSVal(id);
|
|
|
+ $("#stockUpdate").unbind();
|
|
|
+ $("#stockUpdate").bind("click", function () {
|
|
|
+ stockUpdateClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义库存管理 修改按钮点击事件
|
|
|
+ $("#Update_stock").unbind();
|
|
|
+ $("#Update_stock").bind("click", function () {
|
|
|
+ var id2 = CheckBoxVal("stockSTD");
|
|
|
+ if (id2 == "" || id2.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的库存信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ GetSVal(id2);
|
|
|
+ Show_Action_Box("Updatestock");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //绑定搜索按钮点击事件
|
|
|
+ $("#searchB_stock").unbind();
|
|
|
+ $("#searchB_stock").bind("click", function () {
|
|
|
+ getAllStock();
|
|
|
+ });
|
|
|
+ //绑定删除按钮点击事件
|
|
|
+ $("#Del_stock").unbind();
|
|
|
+ $("#Del_stock").bind("click", function () {
|
|
|
+ stockDelClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ /***************** 库存管理结束 ******************/
|
|
|
+
|
|
|
+ /***************** 用料管理开始 ******************/
|
|
|
+ $("#ingredients").bind("click", function () {
|
|
|
+ //构造 用料管理DIV
|
|
|
+ Left_Menu_Click("ingredients", "用料管理", true);
|
|
|
+ getAllingredients();
|
|
|
+ //用料管理 新增按钮点击事件
|
|
|
+ $("#Insert_ingredients").bind("click", function () {
|
|
|
+ //构造 新增用料管理DIV
|
|
|
+ ActionDiv("Insert", "ingredients", "新增用料管理");
|
|
|
+ //读取XML 获取新增表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Insert_Con_ingredients").html($(data).find("Action[name='Insertingredients']").html());
|
|
|
+ SelectDep("ingredientsDepName",""); //构建部门选择框
|
|
|
+ $("#ingredientsSave").unbind();
|
|
|
+ $("#ingredientsSave").bind("click", function () {
|
|
|
+ ingredientsSaveClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义用料管理 新增按钮点击事件
|
|
|
+ $("#Insert_ingredients").unbind();
|
|
|
+ $("#Insert_ingredients").bind("click", function () {
|
|
|
+ Show_Action_Box("Insertingredients");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //用料管理 修改按钮点击事件
|
|
|
+ $("#Update_ingredients").bind("click", function () {
|
|
|
+ var id = CheckBoxVal("ingredientsSTD");
|
|
|
+ if (id == "" || id.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的用料信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //构造 修改用料管理DIV
|
|
|
+ ActionDiv("Update", "ingredients", "修改用料管理");
|
|
|
+ //读取XML 获取修改表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Update_Con_ingredients").html($(data).find("Action[name='Updateingredients']").html());
|
|
|
+ GetingredientsVal(id);
|
|
|
+ $("#ingredientsUpdate").unbind();
|
|
|
+ $("#ingredientsUpdate").bind("click", function () {
|
|
|
+ ingredientsUpdateClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义用料管理 修改按钮点击事件
|
|
|
+ $("#Update_ingredients").unbind();
|
|
|
+ $("#Update_ingredients").bind("click", function () {
|
|
|
+ var id2 = CheckBoxVal("ingredientsSTD");
|
|
|
+ if (id2 == "" || id2.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的用料信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ GetingredientsVal(id2);
|
|
|
+ Show_Action_Box("Updateingredients");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //绑定搜索按钮点击事件
|
|
|
+ $("#searchB_ingredients").unbind();
|
|
|
+ $("#searchB_ingredients").bind("click", function () {
|
|
|
+ getAllingredients();
|
|
|
+ });
|
|
|
+ //绑定删除按钮点击事件
|
|
|
+ $("#Del_ingredients").unbind();
|
|
|
+ $("#Del_ingredients").bind("click", function () {
|
|
|
+ ingredientsDelClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ /***************** 用料管理结束 ******************/
|
|
|
+
|
|
|
+ /***************** 供应管理开始 ******************/
|
|
|
+ $("#supply").bind("click", function () {
|
|
|
+ //构造 供应管理DIV
|
|
|
+ Left_Menu_Click("supply", "供应管理", true);
|
|
|
+ getAllsupply();
|
|
|
+ //供应管理新增按钮点击事件
|
|
|
+ $("#Insert_supply").bind("click", function () {
|
|
|
+ //构造 新增供应管理DIV
|
|
|
+ ActionDiv("Insert", "supply", "新增供应管理");
|
|
|
+ //读取XML 获取新增表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Insert_Con_supply").html($(data).find("Action[name='Insertsupply']").html());
|
|
|
+ SelectDep("supplyDepName", ""); //构建部门选择框
|
|
|
+ $("#supplySave").unbind();
|
|
|
+ $("#supplySave").bind("click", function () {
|
|
|
+ supplySaveClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义供应管理 新增按钮点击事件
|
|
|
+ $("#Insert_supply").unbind();
|
|
|
+ $("#Insert_supply").bind("click", function () {
|
|
|
+ Show_Action_Box("Insertsupply");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //供应管理 修改按钮点击事件
|
|
|
+ $("#Update_supply").bind("click", function () {
|
|
|
+ var id = CheckBoxVal("supplySTD");
|
|
|
+ if (id == "" || id.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的供应信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //构造 修改供应管理DIV
|
|
|
+ ActionDiv("Update", "supply", "修改供应管理");
|
|
|
+ //读取XML 获取修改表单
|
|
|
+ $.get(ActionXML, function (data) {
|
|
|
+ $("#Update_Con_supply").html($(data).find("Action[name='Updatesupply']").html());
|
|
|
+ GetsupplyVal(id);
|
|
|
+ $("#supplyUpdate").unbind();
|
|
|
+ $("#supplyUpdate").bind("click", function () {
|
|
|
+ supplyUpdateClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //重新定义用料管理 修改按钮点击事件
|
|
|
+ $("#Update_supply").unbind();
|
|
|
+ $("#Update_supply").bind("click", function () {
|
|
|
+ var id2 = CheckBoxVal("supplySTD");
|
|
|
+ if (id2 == "" || id2.indexOf(",") >= 0) {
|
|
|
+ alert("请选择一个需要修改的供应信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ GetsupplyVal(id2);
|
|
|
+ Show_Action_Box("Updatesupply");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ //绑定搜索按钮点击事件
|
|
|
+ $("#searchB_supply").unbind();
|
|
|
+ $("#searchB_supply").bind("click", function () {
|
|
|
+ getAllsupply();
|
|
|
+ });
|
|
|
+ //绑定删除按钮点击事件
|
|
|
+ $("#Del_supply").unbind();
|
|
|
+ $("#Del_supply").bind("click", function () {
|
|
|
+ supplyDelClick();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ /***************** 供应管理结束 ******************/
|
|
|
+});
|
|
|
+/***************** document.ready end ********************/
|
|
|
+
|
|
|
+/***************** purchase start ********************/
|
|
|
+
|
|
|
+//新增采购管理保存点击事件
|
|
|
+function purchaseSaveClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#purchaseName").val();
|
|
|
+ var t = $("#purchaseTime").val();
|
|
|
+ var p = $("#purchasePrice").val();
|
|
|
+ var q = $("#purchaseQuantity").val();
|
|
|
+ var r = $("#purchaseRemark").val();
|
|
|
+ //判断价格是否为数字
|
|
|
+ if (!IsNum(p)) {
|
|
|
+ alert("价格请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ loading("purchaseSave");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(P_Server, { type: "purchaseSave", name: n, time: t, price: p, remark: r, quantity: q, id: "" }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("purchaseSave");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Insertpurchase"); //关闭新增窗口
|
|
|
+ clearDataForm("purchaseTable"); //清空新增窗口的表单数据
|
|
|
+ getAllPurchase(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("新增失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+//修改采购管理保存点击事件
|
|
|
+function purchaseUpdateClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#purchaseNameU").val();
|
|
|
+ var t = $("#purchaseTimeU").val();
|
|
|
+ var p = $("#purchasePriceU").val();
|
|
|
+ var q = $("#purchaseQuantityU").val();
|
|
|
+ var r = $("#purchaseRemarkU").val();
|
|
|
+ var i = $("#Updatepurchase").attr("pid");
|
|
|
+ //判断价格是否为数字
|
|
|
+ if (!IsNum(p)) {
|
|
|
+ alert("价格请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ loading("purchaseUpdate");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(P_Server, { type: "purchaseUpdate", name: n, time: t, price: p, remark: r, quantity: q, id: i }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("purchaseUpdate");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Updatepurchase"); //关闭新增窗口
|
|
|
+ getAllPurchase(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("修改失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//删除采购信息
|
|
|
+function PurchaseDelClick() {
|
|
|
+ var ids = CheckBoxVal("purchaseSTD");
|
|
|
+ if (ids == "") {
|
|
|
+ alert("请选择需要删除的采购信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_purchase");
|
|
|
+ //执行ajax
|
|
|
+ $.get(P_Server, { type: "PurchaseDel", id: ids }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data == "true") {
|
|
|
+ getAllPurchase(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("删除失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//获取采购列表
|
|
|
+function getAllPurchase() {
|
|
|
+ //获取数据
|
|
|
+ var s = $("#searchT_purchase").val();
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_purchase");
|
|
|
+ //执行ajax
|
|
|
+ $.get(P_Server, { type: "GetAllPurchase", sT: s }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data != "") {
|
|
|
+ $("#Con_purchase").html(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//获取修改采购表单值
|
|
|
+function GetPVal(id) {
|
|
|
+ var input = "#purchaseSTD input[value='" + id + "']";
|
|
|
+ var td = $(input).parent();
|
|
|
+ var time = $(td).next().next().next().next().next().text();
|
|
|
+ $("#purchaseNameU").val($(td).next().text());
|
|
|
+ $("#purchaseTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
|
|
|
+ $("#purchasePriceU").val($(td).next().next().text());
|
|
|
+ $("#purchaseQuantityU").val($(td).next().next().next().text());
|
|
|
+ $("#purchaseRemarkU").val($(td).next().next().next().next().text());
|
|
|
+ $("#Updatepurchase").attr("pid", id);
|
|
|
+}
|
|
|
+
|
|
|
+/***************** purchase end ********************/
|
|
|
+
|
|
|
+/***************** stock start ********************/
|
|
|
+//获取库存列表
|
|
|
+function getAllStock() {
|
|
|
+ //获取数据
|
|
|
+ var s = $("#searchT_stock").val();
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_stock");
|
|
|
+ //执行ajax
|
|
|
+ $.get(S_Server, { type: "GetAllStock", sT: s }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data != "") {
|
|
|
+ $("#Con_stock").html(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//新增库存管理保存点击事件
|
|
|
+function stockSaveClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#stockName").val();
|
|
|
+ var t = $("#stockTime").val();
|
|
|
+ var q = $("#stockQuantity").val();
|
|
|
+ var r = $("#stockRemark").val();
|
|
|
+
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ loading("stockSave");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(S_Server, { type: "stockSave", name: n, time: t,remark: r, quantity: q, id: "" }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("stockSave");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Insertstock"); //关闭新增窗口
|
|
|
+ clearDataForm("stockTable"); //清空新增窗口的表单数据
|
|
|
+ getAllStock(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("新增失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+//获取修改库存表单值
|
|
|
+function GetSVal(id) {
|
|
|
+ var input = "#stockSTD input[value='" + id + "']";
|
|
|
+ var td = $(input).parent();
|
|
|
+ var time = $(td).next().next().next().next().text();
|
|
|
+ $("#stockNameU").val($(td).next().text());
|
|
|
+ $("#stockTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
|
|
|
+ $("#stockQuantityU").val($(td).next().next().text());
|
|
|
+ $("#stockRemarkU").val($(td).next().next().next().text());
|
|
|
+ $("#Updatestock").attr("sid", id);
|
|
|
+}
|
|
|
+
|
|
|
+//修改库存管理保存点击事件
|
|
|
+function stockUpdateClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#stockNameU").val();
|
|
|
+ var t = $("#stockTimeU").val();
|
|
|
+ var q = $("#stockQuantityU").val();
|
|
|
+ var r = $("#stockRemarkU").val();
|
|
|
+ var i = $("#Updatestock").attr("sid");
|
|
|
+
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ loading("stockUpdate");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(S_Server, { type: "stockUpdate", name: n, time: t,remark: r, quantity: q, id: i }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("stockUpdate");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Updatestock"); //关闭新增窗口
|
|
|
+ getAllStock(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("修改失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//删除库存信息
|
|
|
+function stockDelClick() {
|
|
|
+ var ids = CheckBoxVal("stockSTD");
|
|
|
+ if (ids == "") {
|
|
|
+ alert("请选择需要删除的库存信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_stock");
|
|
|
+ //执行ajax
|
|
|
+ $.get(S_Server, { type: "stockDel", id: ids }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data == "true") {
|
|
|
+ getAllStock(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("删除失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/***************** stock end ********************/
|
|
|
+
|
|
|
+/***************** ingredients start ********************/
|
|
|
+
|
|
|
+//新增用料管理保存点击事件
|
|
|
+function ingredientsSaveClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#ingredientsName").val();
|
|
|
+ var t = $("#ingredientsTime").val();
|
|
|
+ var d = $("#ingredientsDepName").val();
|
|
|
+ var q = $("#ingredientsQuantity").val();
|
|
|
+ var r = $("#ingredientsRemark").val();
|
|
|
+
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ loading("ingredientsSave");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(I_Server, { type: "IngredientsSave", name: n, time: t, depid: d, remark: r, quantity: q, id: "" }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("ingredientsSave");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Insertingredients"); //关闭新增窗口
|
|
|
+ clearDataForm("ingredientsTable"); //清空新增窗口的表单数据
|
|
|
+ getAllingredients(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("新增失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+//修改用料管理保存点击事件
|
|
|
+function ingredientsUpdateClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#ingredientsNameU").val();
|
|
|
+ var t = $("#ingredientsTimeU").val();
|
|
|
+ var d = $("#ingredientsDepNameU").val();
|
|
|
+ var q = $("#ingredientsQuantityU").val();
|
|
|
+ var r = $("#ingredientsRemarkU").val();
|
|
|
+ var i = $("#Updateingredients").attr("Iid");
|
|
|
+
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ loading("ingredientsUpdate");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(I_Server, { type: "IngredientsUpdate", name: n, time: t, depid: d, remark: r, quantity: q, id: i }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("ingredientsUpdate");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Updateingredients"); //关闭新增窗口
|
|
|
+ getAllingredients(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("修改失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//删除用料信息
|
|
|
+function ingredientsDelClick() {
|
|
|
+ var ids = CheckBoxVal("ingredientsSTD");
|
|
|
+ if (ids == "") {
|
|
|
+ alert("请选择需要删除的用料信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_ingredients");
|
|
|
+ //执行ajax
|
|
|
+ $.get(I_Server, { type: "IngredientsDel", id: ids }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data == "true") {
|
|
|
+ getAllingredients(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("删除失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//获取用料列表
|
|
|
+function getAllingredients() {
|
|
|
+ //获取数据
|
|
|
+ var s = $("#searchT_ingredients").val();
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_ingredients");
|
|
|
+ //执行ajax
|
|
|
+ $.get(I_Server, { type: "GetAllIngredients", sT: s }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data != "") {
|
|
|
+ $("#Con_ingredients").html(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//获取修改用料表单值
|
|
|
+function GetingredientsVal(id) {
|
|
|
+ var input = "#ingredientsSTD input[value='" + id + "']";
|
|
|
+ var td = $(input).parent();
|
|
|
+ var time = $(td).next().next().next().next().next().text();
|
|
|
+ $("#ingredientsNameU").val($(td).next().text());
|
|
|
+ $("#ingredientsTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
|
|
|
+ $("#ingredientsQuantityU").val($(td).next().next().next().text());
|
|
|
+ $("#ingredientsRemarkU").val($(td).next().next().next().next().text());
|
|
|
+ $("#Updateingredients").attr("Iid", id);
|
|
|
+ SelectDep("ingredientsDepNameU", $(td).next().next().attr("depid")); //构建部门选择框
|
|
|
+}
|
|
|
+
|
|
|
+/***************** ingredients end ********************/
|
|
|
+
|
|
|
+
|
|
|
+/***************** supply start ********************/
|
|
|
+
|
|
|
+//新增供应管理保存点击事件
|
|
|
+function supplySaveClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#supplyName").val();
|
|
|
+ var t = $("#supplyTime").val();
|
|
|
+ var d = $("#supplyDepName").val();
|
|
|
+ var q = $("#supplyQuantity").val();
|
|
|
+ var r = $("#supplyRemark").val();
|
|
|
+
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ loading("supplySave");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(Supply_Server, { type: "SupplySave", name: n, time: t, depid: d, remark: r, quantity: q, id: "" }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("supplySave");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Insertsupply"); //关闭新增窗口
|
|
|
+ clearDataForm("supplyTable"); //清空新增窗口的表单数据
|
|
|
+ getAllsupply(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("新增失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+//修改供应管理保存点击事件
|
|
|
+function supplyUpdateClick() {
|
|
|
+ //获取数据
|
|
|
+ var n = $("#supplyNameU").val();
|
|
|
+ var t = $("#supplyTimeU").val();
|
|
|
+ var d = $("#supplyDepNameU").val();
|
|
|
+ var q = $("#supplyQuantityU").val();
|
|
|
+ var r = $("#supplyRemarkU").val();
|
|
|
+ var i = $("#Updatesupply").attr("Sid");
|
|
|
+
|
|
|
+ //判断数量是否为数字
|
|
|
+ if (!IsNum(q)) {
|
|
|
+ alert("数量请输入数字!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //加载等待
|
|
|
+ loading("supplyUpdate");
|
|
|
+
|
|
|
+ //执行ajax
|
|
|
+ $.get(Supply_Server, { type: "SupplyUpdate", name: n, time: t, depid: d, remark: r, quantity: q, id: i }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ stopW("supplyUpdate");
|
|
|
+
|
|
|
+ if (data == "true") {
|
|
|
+ CloseBox("Updatesupply"); //关闭新增窗口
|
|
|
+ getAllsupply(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("修改失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//删除供应信息
|
|
|
+function supplyDelClick() {
|
|
|
+ var ids = CheckBoxVal("supplySTD");
|
|
|
+ if (ids == "") {
|
|
|
+ alert("请选择需要删除的供应信息");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_supply");
|
|
|
+ //执行ajax
|
|
|
+ $.get(Supply_Server, { type: "SupplyDel", id: ids }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data == "true") {
|
|
|
+ getAllsupply(); //重新获取数据
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ alert("删除失败...失败原因:" + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+//获取供应列表
|
|
|
+function getAllsupply() {
|
|
|
+ //获取数据
|
|
|
+ var s = $("#searchT_supply").val();
|
|
|
+ //加载等待
|
|
|
+ Cloading("Con_supply");
|
|
|
+ //执行ajax
|
|
|
+ $.get(Supply_Server, { type: "GetAllSupply", sT: s }, function (data) {
|
|
|
+ //等待结束
|
|
|
+ Cstop();
|
|
|
+ if (data != "") {
|
|
|
+ $("#Con_supply").html(data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+//获取修改供应表单值
|
|
|
+function GetsupplyVal(id) {
|
|
|
+ var input = "#supplySTD input[value='" + id + "']";
|
|
|
+ var td = $(input).parent();
|
|
|
+ var time = $(td).next().next().next().next().next().text();
|
|
|
+ $("#supplyNameU").val($(td).next().text());
|
|
|
+ $("#supplyTimeU").val(DateF(time.substring(0, time.indexOf(" "))));
|
|
|
+ $("#supplyQuantityU").val($(td).next().next().next().text());
|
|
|
+ $("#supplyRemarkU").val($(td).next().next().next().next().text());
|
|
|
+ $("#Updatesupply").attr("Sid", id);
|
|
|
+ SelectDep("supplyDepNameU", $(td).next().next().attr("depid")); //构建部门选择框
|
|
|
+}
|
|
|
+
|
|
|
+/***************** supply end ********************/
|