feat refs #6941 hasfile to hasPhysically #2463
|
@ -10,7 +10,7 @@ BEGIN
|
||||||
CALL util.throw('this warehouse has not dms');
|
CALL util.throw('this warehouse has not dms');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NEW.hasFile THEN
|
IF NEW.hasPhysically THEN
|
||||||
SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber
|
SELECT 1 + MAX(hardCopyNumber) INTO vHardCopyNumber
|
||||||
FROM dms
|
FROM dms
|
||||||
WHERE warehouseFk = NEW.warehouseFk;
|
WHERE warehouseFk = NEW.warehouseFk;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`dms_beforeUpdate`
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`dms_beforeUpdate`
|
||||||
BEFORE UPDATE ON `dms`
|
BEFORE UPDATE ON `dms`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vHardCopyNumber INT;
|
DECLARE vHardCopyNumber INT;
|
||||||
|
|
||||||
IF (NEW.hasFile <> 0) AND (OLD.hasFile = 0) AND (NEW.hardCopyNumber IS NULL)
|
IF (NEW.hasPhysically <> 0) AND (OLD.hasPhysically = 0) AND (NEW.hardCopyNumber IS NULL)
|
||||||
OR
|
OR
|
||||||
(NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN
|
(NEW.hardCopyNumber = OLD.hardCopyNumber AND OLD.warehouseFk <> NEW.warehouseFk) THEN
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ BEGIN
|
||||||
|
|
||||||
IF ((NEW.hardCopyNumber = 0) OR NEW.hardCopyNumber IS NULL) AND (OLD.hardCopyNumber <> 0) THEN
|
IF ((NEW.hardCopyNumber = 0) OR NEW.hardCopyNumber IS NULL) AND (OLD.hardCopyNumber <> 0) THEN
|
||||||
|
|
||||||
SET NEW.hasFile = 0;
|
SET NEW.hasPhysically = 0;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE vn.dms CHANGE hasFile hasPhysically tinyint(4) DEFAULT 0 NOT NULL;
|
||||||
|
|
Loading…
Reference in New Issue