预警指标设置

//Controller
class 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





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 += "";
                Html += "";
                Html += "";
                Html += "";
                Html += "";
                Html += "";
                if (json.data) {
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                } else {
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                    Html += "";
                }
                Html += "
预警等级连续天数积压百分比
黄色预警
红色预警
黄色预警
红色预警
"; Html += "
仓库来货积压预警等级划分及处理方案
"; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += ""; Html += "
预警等级指标处理办法
黄色连续三天未处理 PO 数 ≧ 40% (上周日均处理 PO 数)1、内部加班,包括质检组外的人员。
2、加大招聘需求,紧急加入。
3、积压超过的组组内人员协助。(组积压数 ≧ 上周日均处理 PO 数 * 40% / 组数)
红色1、平常期间预警条件:
连续三天未处理 PO 数 ≧ 100% (上周日均处理 PO 数)
2、国庆和春节备货期间预警条件:
连续三天未处理 PO 数 ≧ 200% (上周日均处理 PO 数)
1、电商所有部门支援。
2、按实际库存销售。
3、变更预警,减少备货量。
"; $("#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); } } }); }

你可能感兴趣的:(Zend,Framework)