預警指標設定,預警指標
//Controllerclass Product_ReceivingController extends Zend_Controller_Action { //預警指標設定 public function warningIndicatorSettingAction() { $warehouseId = $this->_request->getParam("userWarehouse", ""); $type = $this->_request->getParam("type", ""); $yellowDays = $this->_request->getParam("yellow_days", ""); $yellowPercentage = $this->_request->getParam("yellow_percentage", ""); $redDays = $this->_request->getParam("red_days", ""); $redPercentage = $this->_request->getParam("red_percentage", ""); $return = array( "ask" => 0, "data" => "", "msg" => "", ); if (!$warehouseId) { $return['msg'] = "請選擇倉庫"; die(json_encode($return)); } $configId = Common_Service_Config::getByAttribute("WARNING_INDICATOR_SETTING", $warehouseId); if ($type == 0) { $return = array( "ask" => 1, "data" => unserialize($configId['config_value']), ); } else { $combination = array( "yellow_days" => $yellowDays, "yellow_percentage" => $yellowPercentage, "red_days" => $redDays, "red_percentage" => $redPercentage, ); if ($configId) { if (Common_Service_Config::update(array("config_value" => serialize($combination)), $configId['config_id'])) { $return = array( "ask" => 1, "msg" => "修改成功", ); } else { $return['msg'] = "修改失敗"; } } else { $warehouseNameCn = Warehouse_Service_Warehouse::getById($warehouseId); $combinat = array( "config_attribute" => "WARNING_INDICATOR_SETTING", "warehouse_id" => $warehouseId, "config_value" => serialize($combination), "config_description" => $warehouseNameCn['warehouse_name_cn'] . "預警指標設定", "config_create_time" => date("Y-m-d H:i:s"), ); if (Common_Service_Config::add($combinat)) { $return = array( "ask" => 1, "msg" => "添加成功", ); } else { $return['msg'] = "添加失敗"; } } die(json_encode($return)); } die(json_encode($return)); }}Html<input class="button" type="button" value="預警指標設定" onclick="warningIndicatorSetting()" ><div id="warningIndicatorSettingDialog" title="預警指標設定" ></div>js//初始化$(function () { //預警指標設定 $("#warningIndicatorSettingDialog").dialog({ autoOpen: false, modal: true, width: 1100, height: 400, zIndex: 200, show: "slide", title: "預警指標設定", buttons: { "確定": function () { updateWarningIndicatorSetting(); }, "關閉": function () { $(this).dialog("close"); } } });});//預警指標設定function warningIndicatorSetting() { loading(); var userWarehouse = $("[name=userWarehouse]").val(); $.ajax({ url: "/product/receiving/warning-indicator-setting", data: { "type": 0, "userWarehouse": userWarehouse }, type: "post", dataType: "json", async: false, success: function (json) { var Html = ""; if (json.ask) { Html += "<table width='100%' height='30%' border='1' style='text-align: center'>"; Html += "<tr>"; Html += "<th>預警等級</th>"; Html += "<th>連續天數</th>"; Html += "<th>積壓百分比</th>"; Html += "</tr>"; if (json.data) { Html += "<tr>"; Html += "<td>黃色預警</td>"; Html += "<td><input type='text' name='yellow_days' value='" + json.data.yellow_days + "' style='text-align: center'></td>"; Html += "<td><input type='text' name='yellow_percentage' value='" + json.data.yellow_percentage + "' style='text-align: center'></td>"; Html += "</tr>"; Html += "<tr>"; Html += "<td>紅色預警</td>"; Html += "<td><input type='text' name='red_days' value='" + json.data.red_days + "' style='text-align: center'></td>"; Html += "<td><input type='text' name='red_percentage' value='" + json.data.red_percentage + "' style='text-align: center'></td>"; Html += "</tr>"; } else { Html += "<tr>"; Html += "<td>黃色預警</td>"; Html += "<td><input type='text' name='yellow_days' value=''></td>"; Html += "<td><input type='text' name='yellow_percentage' value=''></td>"; Html += "</tr>"; Html += "<tr>"; Html += "<td>紅色預警</td>"; Html += "<td><input type='text' name='red_days' value=''></td>"; Html += "<td><input type='text' name='red_percentage' value=''></td>"; Html += "</tr>"; } Html += "</table>"; Html += "<h5 style='margin-top: 0.5cm; text-align: center'>倉庫來貨積壓預警等級劃分及處理方案</h5>"; Html += "<table width='100%' height='50%' border='1'>"; Html += "<tr style='background-color: #D0CECE'>"; Html += "<th>預警等級</th>"; Html += "<th>指標</th>"; Html += "<th>處理辦法</th>"; Html += "</tr>"; Html += "<tr>"; Html += "<td style='background-color: yellow; text-align: center'>黃色</td>"; Html += "<td>連續三天未處理 PO 數 ≧ 40% (上周日均處理 PO 數)</td>"; Html += "<td>1、內部加班,包括質檢組外的人員。<br/>2、加大招聘需求,緊急加入。<br/>3、積壓超過的組組內人員協助。(組積壓數 ≧ 上周日均處理 PO 數 * 40% / 組數)</td>"; Html += "</tr>"; Html += "<tr>"; Html += "<td style='background-color: red; text-align: center'>紅色</td>"; Html += "<td>1、平常期間預警條件:<br/>連續三天未處理 PO 數 ≧ 100% (上周日均處理 PO 數)<br/>2、國慶和春節備貨期間預警條件:<br/>連續三天未處理 PO 數 ≧ 200% (上周日均處理 PO 數)</td>"; Html += "<td>1、電商所有部門支援。<br/>2、按實際庫存銷售。<br/>3、變更預警,減少備貨量。</td>"; Html += "</tr>"; Html += "</table>"; $("#warningIndicatorSettingDialog").dialog("open").html(Html); } else { alertTip(json.msg); } } }); closeLoading();}//更新預警指標設定function updateWarningIndicatorSetting() { var userWarehouse = $("[name=userWarehouse]").val(); var yellow_days = $.trim($("[name=yellow_days]").val()); var yellow_percentage = $.trim($("[name=yellow_percentage]").val()); var red_days = $.trim($("[name=red_days]").val()); var red_percentage = $.trim($("[name=red_percentage]").val()); $.ajax({ url: "/product/receiving/warning-indicator-setting", data: { "type": 1, "userWarehouse": userWarehouse, "yellow_days": yellow_days, "yellow_percentage": yellow_percentage, "red_days": red_days, "red_percentage": red_percentage }, type: "post", dataType: "json", async: false, success: function (json) { if (json.ask) { $("#warningIndicatorSettingDialog").dialog("close"); } else { alertTip(json.msg); } } });}
查看評論